Content Visibility for Divi Builder.
Content Visibility for Divi Builder allows Sections and Modules to be displayed/hidden based on the outcome of a PHP boolean expression.
This plugin is for both the standalone Divi theme (or child themes thereof) or the Divi Builder plugin, versions 2.6 or higher!
/wp-content/plugins/content-visibility-for-divi-builder
directory, or install the plugin through the WordPress plugins screen directly.Yes! It detects and modifies Modules and Sections by class inheritance. As long as Elegant Themes continues to have a single root class for everything, this plugin should detect all of them, including third party ones!
Yes. If you decide to deactivate or uninstall this plugin, the “Content Visibility” configuration option will disappear from the Divi Builder, and will not have any effect on the frontend output.
Of course, the “Content Visibility” settings that were defined for a particular Section or Module will continue to persist in the database, until that post/page is updated.
This can be a good thing, however, as you may want to reinstall/reactivate in the future and not have to re-enter all of your “Content Visibility” expressions!
Once the plugin is installed and activated, a “Content Visibility” option will appear in each Section or Module’s settings on either the Advanced tab under Visibility (for Divi 4.x) or the General Settings / Content tab (for Divi 3.x or lower.)
You may enter any PHP boolean expression you would like, (e.g. is_user_logged_in()), and the Section or Module will only display if the expression evaluates to true.
NOTE: Complex expressions are usually best entered as a custom function call defined in a child theme or plugin!
So, for example, you could enter my_custom_function() in the Content Visibility option, and then define that function (returning true or false) in your child theme’s functions.php.
If there are several common boolean expressions you use, this also has the added benefit of allowing you to change the behavior of your content by simply modifying the function body once instead of re-entering Content Visibility options all over the place.