# Sub-Conditions
Elementor Pro AdvancedConditions 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(); );
}
}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
- Condition All Label – The
get_all_label()
method returns the all/any label that will be displayed to the user, if the condition has sub-conditions.
- Sub-Conditions – The
register_sub_conditions()
method registers sub-conditions.