- How to Configure Conditional Display on WordPress Content?
- How to Set up Login Status Conditions?
- How to Set up Conditions based on User Roles?
- How to Set up Visibility Conditions on Post Type?
- How to Set up Browser Restrictions?
- How to Use Date & Time Visibility Conditions?
- How to Set up Query String Conditions?
- How to Set Visibility Restrictions on URL Contains?
- How to Display Conditions on Archive?
- How to Apply Multiple Display Conditions on Selected Content?
With the Conditional Display extension from Essential Blocks, you can show your desired content according to the logic conditions you’ve specified. With this advanced extension, you can include multiple conditions and logics at a time on selected blocks from Gutenberg editor.
Note: Before you begin, make sure that you have installed & activated Essential Blocks Pro plugin to configure this Conditional Display extension.
How to Configure Conditional Display on WordPress Content? #
You can locate the feature, Conditional Display, under the ‘Advanced’ tab of any Essential Blocks’ block.
To Configure display conditions on content created with blocks by Essential Blocks, select a block. From the right editing panel, go to Advanced tab, then click on Conditional Display. Toggle the option ‘Enable Conditional Display’ to successfully activate the extension.
After you have successfully enabled the feature, you can see all the display conditions, logics, etc. options under the Conditional Display tab.
For a quick brief of all conditions, features and logics in the Essential Blocks Conditional Display extension.
Condition Types:
- Login Status
- User Roles
- Browser
- Date and Time
- Query String
- URL Contains
- Archive
Visibility Rules:
- Show If Conditions Are Met
- Hide If Conditions Are Met
- Always Hide
Logic Types:
- All Conditions Must Be True
- At Least One Condition Must Be True
Let’s check out how to configure these display conditions efficiently.
How to Set up Login Status Conditions? #
From Condition Types, select ‘Logic Status’ from the drop-down. You can limit the display of content with this condition according to whether site visitors are logged in or out.
After that, you will find two options under Login Status: Logged In and Logged Out. You can choose either of them and set the visibility rules as ‘display block content while visitors are logged in’ or vice versa.
For this tutorial, we have set the display conditions as this: If the site visitors are logged in, they won’t see the content of the selected block. If they are logged out, then you can see the content of the block. Here is a quick preview of this display logic.
How to Set up Conditions based on User Roles? #
Enabling the ‘User Role’ condition allows you to display WordPress content based on the various user roles on your WordPress site. This will help you to automatically show specific content to subscribers, administrators, or authors on your website.
From the ‘Condition Type’ dropdown, select ‘User Role’ from the dropdown menu. You can then choose which user roles you wish to apply visibility conditions to. You can select multiple roles at a time.
After making the changes, click on the ‘Save’ button to save the changes.
For this tutorial, we have set the display conditions as this: If the site visitors are logged in as Administrators, Editors or Authors, they will see the content of the selected block. If they are logged in as other roles: Contributor, Subscriber or others, then they can’t see the content of the block. Here is a quick preview of this display logic.
How to Set up Visibility Conditions on Post Type? #
Similarly, activate the ‘Post Type’ conditional logic in the Gutenberg editor to display specific types of content. If you have a Global block, synced block or the same content is added in multiple pages and posts, then you can set visibility conditions based on the post types. The same content can be viewed from pages and hidden from ‘post’ or other places.
From the ‘Condition Type’ dropdown, select ‘Post Type’ from the dropdown menu. You can then choose on which post types you wish to apply visibility conditions. You can select multiple types at a time.
After making the changes, click on the ‘Save’ button to save the changes.
For this tutorial, we have set the display conditions as this: The selected block will be previewed only if the post type is page. If the site visitors are visiting a page with a selected block, the title will be visible to them. If visitors are visiting a post with the same synced block, then they can’t see the title. Here is a quick preview of this display logic.
How to Set up Browser Restrictions? #
With Essential Blocks, you can also choose which content to display or conceal for a particular browser. You can apply viewing restrictions for multiple browsers if we need to.
From the ‘Condition Type’ dropdown, select ‘Browser’ from the dropdown menu. You can then choose on which browsers you wish to apply visibility conditions. You can select multiple types at a time.
After making the changes, click on the ‘Save’ button to save the changes.
For this tutorial, we have set the display conditions as this: The selected block will be previewed only if viewers are visiting from Google Chrome browser. If the site visitors are visiting from a different browser like Safari, it won’t be visible to them. Here is a quick preview of this display logic.
How to Use Date & Time Visibility Conditions? #
You can use the ‘Date & Time’ conditional logic to display a section or page in Gutenberg only during specific time periods. You can choose your time with 4 available conditions like ‘Between’ two dates, ‘Not Between’ two dates, ‘Exactly On’ or ‘Not On This Page’.
If we pick the ‘Exactly On’ or ‘Not On This Date’ option, then you will get a field to pick the exact date. If you pick ‘Between’ or ‘Not Between’, then you will get options to pick the date range.
How to Set up Query String Conditions? #
To set visibility restrictions on query strings, you need to select the type as ‘Query String’, give a ‘Query Parameter Key’ and ‘Expected Value’ here, and click on the Save button. It will check the URL and allow visitors to show any specific information that matches the value you have set.
For this tutorial, we have added ‘Ref’ as our ‘Query Parameter Key’ value and add ‘Newsletter’ as our ‘Expected Value’. When you visit the webpage, you will find the block in the dedicated place. But when you browse the website with this query string ‘?ref=newsletter’ can see the block isn’t showing.
How to Set Visibility Restrictions on URL Contains? #
You can set up any specific string or URL to show any specific content. Go to the ‘Condition Type’ and choose the ‘URL Contains’. You can choose ‘Target URL’ as the current one or any referred one.
Later, set the ‘Match Type’ as Contain or Doesn’t Contain and in the ‘String’ field, add the slug value. After that, hit the save button.
After setting up the URL contains conditions, visit your page and add the ‘String’ that you have set in the URL contains and search. You will see that the Content is now showing on that particular string.
How to Display Conditions on Archive? #
You can display any specific section on your archive page or hide from selected ones. Set the ‘Condition Type’ as ‘Archive’. Then, select ‘Archive Type’ from the Post Type, Search, Dates, Author, Taxonomy as your preferences.
From ‘Select Post Type’, select archive pages on which you want to add visibility control. You can pick specific ones or select All. This way, you can show or hide content from selected archive pages easily.
How to Apply Multiple Display Conditions on Selected Content? #
Apart from applying single displaying rules, you can apply two or more on a selected block seamlessly. Click on the ‘Add Item’ under the ‘Condition Type’ section and add multiple options. You can delete conditions if needed.
After that, you have to configure the visibility rules and logic types. From ‘Visibility Rules’, you can select to display or hide if all conditions are met. You can choose from ‘Logic Type’ whether applying rules is required if all conditions are true or just one of them is.
This is how you can easily use the Essential Blocks Conditional Display extension on your WordPress website and choose what content to display under which conditions. Getting stuck?
Feel free to Contact Our Support for further assistance.