Conditionals
The following attributes can be used on every element to show or hide it, based on specific conditions.
Show If
By using the attribute:
show-ifconditionThe element will be rendered only if the condition is met.
Hide if
By using the attribute:
hide-ifconditionThe element will not be rendered only if the condition is met.
Conditions
Below you will find all valid conditions, divided by sector, for brevity you will find all the attributes only with show-if, but you can change it with hide-if without any issue:
User
Show/Hide element if the user is currently logged in:
show-iflogged-inDynamic Box
Show/Hide element if the dynamic box is not empty:
show-ifdynamic-boxRules Conditions
Rules are functionalities that allow to create specific conditions, manageable from the Udesly WP plugin.
Attribute is:
show-if:rulerule slugACF conditions
This is to hide/show an element if the ACF field is set.
Attribute is:
show-if:acfslug of the acf fieldWooCommerce Conditions
Upsells
This is to hide/show an element if the current product has upsells:
show-if:wcupsellsRelated
This is to hide/show an element if the current product has related:
show-if:wcrelatedRating
This is to hide/show an element if the current product has rating:
show-if:wcratingIn Stock
This is to hide/show an element if the current product is in stock:
show-if:wcin-stockBackorder allowed:
This is to hide/show an element if for the current product the backorder feature is enabled, regardless of the presence or absence of a product in stock:
show-if:wcbackorder-allowedOn Backorder
This is to hide/show an element if the current product can be bought in backorder:
show-if:wcon-backorderNotes
The elements you hide/show with conditionals will not be sent at all from the Server to the Browser, so they will not be "hidden" by css or js, they will not be present at all inside the DOM!