
Divi Display Logic
Current Version: 2.6.5PHP Version Required : 8.0 +WP Version Required : 6.2 +
Description
The revolutionary and original plugin for conditional logic in Divi, allows you to add logic/conditions (as many as you like!) to be used with any Divi element (module, child module, section, row). The plugin is incredibly easy to use in the Divi Visual Builder.
Ever had to remember to add a sale banner to your site at a certain time?
Want to show different slides in a slider module to different users or at different times?
Want to show different items in pricing table modules based on time or status?
Ever had to get up early to change time sensitive content?
Ever wanted to show a specific message to new users?
Read on!
Simply put, you can decide when any of your content is shown and to whom based on any number of conditions you can set (or write yourself). The easiest example is differing content for logged in and out users but it doesn’t stop there.. you can show content based on date/time, location, user role, environment or anything else.
There are a number of pre-set examples and a polished interface to make using this plugin very easy indeed.
On activating the plugin you will see a new interface inside the Divi Visual Builder ‘Advanced’ tab. Look at the Custom Class/ID tab and you will notice a handy on/off switch to manage the logic/conditions. Inside the popup you will find full instructions and some handy controls to get the logic you want.
Examples
You might be thinking now “great idea but how would I use it??’. Here’s a few examples we’ve had so far from the community!
Show logged in or out slides in a slider module or schedule them to show/hide
Show a marketing homepage to logged out but show handy links/articles to those logged in
Create a simple teaser/locked content section based on a query string variable, post item, session variable or cookie!
Show members only content based on WordPress capability or role.
Show content to users in their language?
Use a pricing table but show certain prices to users based on their logged in/out status or the time/date
A restaurant business may wish to show the breakfast menu in the morning but the evening menu in the afternoon
An eCommerce store may wish to show documentation and post-purchase links to those who are logged in or have purchased (custom php filter)
Show an article or page to those who have signed up to a mailing list (custom php filter)
Show offers or holiday wishes on a per country basis..
Show adverts and offers only once – resetting every 30 days or so (configurable)
Hide your local offers to those who don’t live in the same city
And many more!
Examples Built-In
Out of the box there are LOTS of pre-defined conditions you can use. These range from the most basic show/hide based on logged/out status to something more complex like show/hide based on date/time constraints. See below for the full example list included the plugin:
SHOW this content on Christmas Eve 2017
HIDE this content on New Years Day 2018
SHOW this content to a specific user ID or several user IDs
SHOW the content for ONLY the 16th August 2017 (Sean’s Birthday!)
SHOW this content on Mondays ONLY
SHOW this content at 3pm and hide at 4pm
HIDE this content on Weekdays
SHOW this content if the current page has the category “News”. Note: term uses the slug
HIDE this content if the user IS logged out
HIDE this content if the user IS logged in
SHOW this content is a specific item is in the querystring (with optional value match)
HIDE this content is a specific item is in the querystring (with optional value match)
SHOW this content is a specific item is in the post array (with optional value match)
HIDE this content is a specific item is in the post array (with optional value match)
SHOW this content is a specific item is in the session (with optional value match)
HIDE this content is a specific item is in the session (with optional value match)
SHOW this content is a specific item is in the cookie array (with optional value match)
HIDE this content is a specific item is in the cookie array (with optional value match)
SHOW this content if the user has the Editor role
HIDE this content from users with the Subscriber role
SHOW this content if the user has the capability “view_content” (example. add your own)
SHOW this content if the user is in the UK or France
HIDE this content if the user is in the USA
SHOW this content to users if their language is English or German
HIDE this content to users if their language is French
HIDE this content after showing it only once (adverts/offers)
SHOW this content if the user is in the city of Chester, UK
HIDE this content if the user is in the town of London, UK
SHOW this content to user if PHP add_filter() returns true (advanced!). Supports up to 3 optional arguments.
HIDE this content from user if PHP add_filter() returns true (advanced!). Supports up to 3 optional arguments.
All of the built in examples can be edited. They are simply included to get you started. The date/time picker pre-fills the dates for you to minimise editing and the rest of the conditions are straightforward to edit to suit your needs.
Developers
Any encapsulating shortcode will work (one with a start and end tag) if you prefer to work directly with the shortcode. As long as the encapsulating shortcode alters the $content variable passed to the function based on your own condition this will work. To make things easier though you may prefer to use the built in add_filter example as it gives context to your shortcodes and allows you to add optional arguments which make it easier to read.
You’ll also find the ‘dss_prefill_options’ filter handy as it will pass the post type and an empty string for you to edit. This will allow you to add your own “option” html tags to the pre-defined logic dropdown. Just make sure that your shortcode is the “value” attribute and the plugin will do the rest!
You may install this product on any number of websites that you build for yourself or your clients. You will receive 6 months support and 12 months of updates from the date of purchase, after which you will have to purchase the product again at 50% of the initial purchase price.
Changelog
V1.0 - 13/7/17 - initial release
V1.1 - 17/7/17 - Added dss_pre_shortcode_parse action to fire just before the logic is run on any shortcode. Also dss_pre_dss_content_parse which runs only when the dss_content shortcode is parsed (passing the $atts array). This will allow you to clear caches etc
V1.2 - 30/7/17 - Fixed bug causing activating not to work
V1.3 - 10/8/17 - Fixed logic requiring user to be logged in to work.
V1.4 - 14/9/17 - Fixed reference to enqueue script which was incorrectly called as enqueue style. oops!
V1.5 - 27/10/17 - Added 'show once' filters - Added timezone setting code to aid date related filters
V1.6 - 03/11/17 - Fixed Auto Update functionality
V1.7 - 19/02/18 - Added show/hide logic built in for the querystring ($_GET), post array ($_POST), session ($_SESSION) and cookies ($_COOKIE) - Show and Hide roles now support multiple roles rather than just the one show_role="subscriber,editor" hide_role="administrator,author" etc...
V1.8 - 07/03/18 - Added user_show filter to support showing/hiding of content to user IDs specifically either individially or comma separated - Added hide_post_meta and show_post_meta filters to handle showing/hiding based on the current post/page custom fields
V1.9 - 07/03/18 - The existing GeoIP system is now retired so this was replaced with another that works. Thanks to Ethan Lessiter for this fix
V2.0 - 12/03/18 - Web based IP lookups for location were proving slow so replaced with a filebased system from Maxmind GeoIP
V2.1 - 13/04/19 - Small fix to allow more than one GEO IP lookup to be performed on the same page.
V2.2 - 15/08/19 - VB Ready functionality - Fixed updater script
V2.3 - 12/01/20 - New Interface for the VB. Removed support for Classic Divi Builder - Added ability to set multiple items of logic instead of just the one - Added admin mode so administrators still see DDL controlled content but with subtly different styling to indicate the logic - Removed GeoIP files causing the plugin to be larger than 20mb. Now sites download the library in the background on activation instead. - Added ability to set logic on child modules such as pricing tables, sliders and tabs - Fixed Timezone offset function
V2.3.1 - 12/01/20 - Fixed issue with geoip library inclusion - CSS issue with the theme builder, z-index increase - Added location caching to increase speed of lookup and to avoid repeating checking locations etc.
V2.3.2 - 14/01/20 - Added new filter to add custom logic and helpers! Check the documentation site for more info on this. - Added 5 new ACF filters and helpers. Will show when the ACF plugin is turned on. - Added scope for cloudflare override for location lookup
V2.3.3 - 16/01/20 - Fixed Fatal error caused by other plugins using the GeoIPlibrary. - Fixed styling issue on the Divi Theme Options page (jquery-ui issue - Updated Location code with a file exists for the GeoIP DAT file - Updated caching of GeoIP DAT file to handle plugin updates
V2.3.4 - 17/01/20 - Converted remote storage of geoip files to use Amazon S3 - Remote copy of geoip files now uses a stream rather than memory as it was causing fatal errors in some cases - Added a PHP filter for the documentation info in the popup - Added ability to refer to roles by ID or Label in show_role and hide_role
V2.3.5 - 20/01/20 - Refactored PHP to try and avoid fields clearing automatically. - Added JS console logging for debugging in future
V2.4 - 19/02/20 - Added support for the Divi Theme Builder - Fixed issue with broken link to Magnific popup JS
V2.5 - 16/05/20 - Added show_lang and hide_lang logic. show_logic="EN,FR" for instance or hide_logic="DE"
V2.5.1 - 21/05/20 - Removed jQuery UI conflict on the Divi Theme Options page - Removed Scripts from outputting backend info on the front end
V2.6 - 17/06/21 - Fixed show content at a certain time - Fixed hide content at a certain time - Fixed show and hide content between certain time - Fixed show content if user in particular city - Fixed hide content if user in particular city
V2.6.5 - 31/01/22 - Fixed Display Logic Helper Popup