title: "Sub-Conditions" post_status: publish comment_status: open taxonomy: category: - elementor-developers-docs post_tag: - Theme Conditions - Src - Repos


Sub-Conditions

Conditions can have sub-conditions in order to narrow the conditions. For example, instead of applying a condition to all Singular pages, applying it only to Posts, or a specific post. Sub-conditions help the user focus the main condition.

Sub-Condition Methods

When conditions have sub-conditions, the condition class needs to use the following two methods:

class Elementor_Test_Condition extends \ElementorPro\Modules\ThemeBuilder\Conditions\Condition_Base {

    public function get_all_label(): string {
        return esc_html__( 'All Items', 'textdomain' );
    }

    public function register_sub_conditions(): void {
        $this->register_sub_condition( new Elementor_Test_Sub_Condition_1(); );
        $this->register_sub_condition( new Elementor_Test_Sub_Condition_2(); );
    }

}

All Sub-Conditions

Sub-Conditions