How To Apply Dynamic Rules On Sections and Widgets
Dynamic Rules can be used to show or hide any attribute on a page or template. You can apply this functionality and set a display rule on any content inside a widget or even apply it to the entire Elementor Section / Column.
You can restrict content based on User, Single Posts, Archive Posts, and ACF data.
Steps to enable Dynamic rules functionality on Sections/ Column and Widgets:
- Edit the Section or Widget >> click on the AE Pro tab.
- Then Enable the Dynamic Rule functionality.
The configuration settings are almost the same for both Sections and Widgets. You will get one additional option to Render the Html in the case of Widget.
- Relation: Set the relation with Any or All the terms.
- Show/Hide: If all the conditions are satisfied, you can choose to display or hide the element.
- Rules: Click on the Add Item button to add multiple conditions. You can apply dynamic conditions based on four elements: User, Single Post, Archives, and ACF.
- Render HTML(in case of widgets): Enable the option to render the HTML.
- Fallback: If you want to display alternate content to the user, you can add text content manually or choose an AE Template, or an Elementor Saved section if the element is hidden.
- Rule Check Filter: Here, you can add your own filter to dynamic rules.
Select the User type according to which you want to show/ hide the content. For example, you can select Validation, User, User Roles.
- Type: Select User or User Roles if you want to set the display conditions based on Users. The validation condition is applied to only logged-in users.
- Operator: Select the operator type like Is Equal, Not Equal, Contains, Does Not Contain, Is Empty, etc.
- Value: Enter the user name or role for which you want to set the conditions. You can apply conditions for multiple users. Just set Contains in the Operator option in place of Equal.
This conditional rule applies to the Single Post types templates, WordPress Default pages, and Post Type and Term.
- Type: Select if you want to apply rules on custom post type content, post-term or default pages
- Post Types: All custom post types are displayed; select the post types you want to apply the dynamic rule.
- Operators: Select the conditional operator based on which you want to show or hide content.
- Value: Enter the post name on which to apply the condition.
On selecting Default Page, in the Value option, choose the page on which you want to allow or restrict the content if all conditions are satisfied. For example, you can select WordPress Default pages like 404 page, Home Page, Blog, and FrontPage.
You can apply the dynamic rules to the Archives Templates. Like Taxonomy Archives, Term Archives, Post Type Archives, Date Archives, and Search Archives templates.
- Type: Select the Archive type on which you want to apply the dynamic condition; here, I have selected Date Archive.
- Apply To: Choose where you want to apply the dynamic condition on the Year archive template or the Month archive or Date archive template.
- Operator: Select the conditional operators.
- Value: Select a specific date on which you want to show and hide the content if all the conditions are satisfied.
In the case of Search Archive, you can show or hide the contents based on Search Term and Search Result; you can set the conditional operators base on the search result value you get.
Advanced Custom Fields
It lets you show or hide the Advanced Custom Fields data based on text, relationship, taxonomy, and Date and Time.
- Type: Select the ACF type data like text, choice, relationship, etc. The other control options will be based on the type you select.
- ACF Name: Enter the custom field name or slug.
- Operators: Select the conditional operators.
- Value: Enter the value in the custom field on which you want the rule to depend.
- It also supports the Repeater field, Group field and Options page.
- Parent: When you select ACF type, then a parent field will be shown with the options Repeater and Group. New controls will be displayed based on your selection.
- Suppose you selected parent as a repeater, a few more settings will be shown like Repeater field, sub field.
- Based on your selection and entered value, the rule will Show/Hide the custom field data.
** In case of applying rules on multiple values, select Contains in place of Is Equal operator.