Cette extension n’a pas été testée avec plus de trois mises à jour majeures de WordPress. Elle peut ne plus être maintenue ou supportée et peut avoir des problèmes de compatibilité lorsqu’elle est utilisée avec des versions de WordPress plus récentes.

Content Visibility for Divi Builder

Description

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!

Captures d’écran

  • The Content Visibility option in the Divi 4.x interface.

  • The Content Visibility option in the Divi 3.x Visual Builder interface.

  • The Content Visibility option in the 3.x and older Divi Builder backend interface.

Installation

  1. Upload the plugin files to the /wp-content/plugins/content-visibility-for-divi-builder directory, or install the plugin through the WordPress plugins screen directly.
  2. Activez l’extension sur la page « Extensions » dans WordPress
  3. You’re Done! You will notice that Section and Module settings dialogs will now have « Content Visibility » as a configurable setting.

FAQ

Will this work for any module, even custom ones?

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!

What if I deactivate this plugin? Will all of my content reappear automatically?

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!

How do I use it!?

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.

Avis

8 octobre 2024
I found this addon to be very useful in putting up content for a persons website. It allows you to create PHP functions or use inherent true/false functions that you can then control what content shows based on that. I find it useful in having one content being shown before a certain date and another block being set to show after a certain date. Allowing you to schedule content changes within the website.
9 septembre 2024 1 réponse
This is a very simple plugin to use once you get the hang of it, and extremely powerful and useful. I use this with ACF to add custom fields to post and product types so that I can add a wide variety of optional information to posts and products, and then only display the field labels or sections on the front end if that optional data exists on the product. Makes it easy to build complex product layouts for complex products, and not waste space showing sections that aren’t relevant without having to design multiple different, product specific layouts. I’d love to see an update just as an indication the product is still supported and someone is looking at it, but it works extremely well. 10/10 would recommend!
3 janvier 2024
Happy to have come across this plugin, which we use for a Divi site in combination with Restrict Content Pro (RCP). RCP can hide content based on user-role or membership-level by placing it between shortcodes. This works within text-modules, but not with other modules or for larger parts of a layout such as rows or sections. But with the Content Visibility for Divi Builder plugin we can now hide whatever Divi element we like in combination with RCP’s way of restricting content in template files. So for example we can add a boolean expression in the visibility field to only show content to members with level ID 3 OR admins: in_array( 3, rcp_get_customer_membership_level_ids() ) || current_user_can( ‘manage_options’ ) Very handy and works really well. Thank you!
11 juin 2024
Can’t do without it. Please sell this to Divi or WPFusion, or be sure to keep maintaining it. We would be happy to do a paid subscription because we very much need and enjoy this functionality.
Lire les 98 avis

Contributeurs/contributrices & développeurs/développeuses

« Content Visibility for Divi Builder » est un logiciel libre. Les personnes suivantes ont contribué à cette extension.

Contributeurs

Journal

3.22

  • Fix compatibility with Stop Spammers plugin. Thanks to @kindred for providing access to a test environment exhibiting the issue!

3.21

  • Fix compatibility with the Divi Library.

3.20

  • Fix compatibility with the Divi Theme Builder.

3.19

  • Restore support for DiviExtension modules in Divi 4.10.x.

3.18

  • Fix the backend documentation page so that currently-available modules are shown.
  • Fix the rating link image’s styles.

3.17

  • Restore support for lazy-loaded modules in Divi 4.10.x. Special thanks to @chaostica, @jgarces and @sthaney for contributing information which helped lead to the fix!

3.16

  • Fix extraneous inclusion of builder.js, which in turn fixes various backend/classic editor logic. Thanks to Bernard Lemieux of bernardlemieux.ca!

3.15

  • Fix the behavior of content_visibility_for_divi_builder_shortcode_* filters.

3.14

  • Emergency hotfix for crash introduced in 3.13.

3.13

  • Fix PHP v7.4.x notice spam with recent Divi versions.

3.12

  • Fix interoperability issues with newer WordPress versions.
  • Fix issues with Divi Builder 4.x releases.

3.11

  • Remove hold harmless agreement.

3.10

  • Remove usage tracking entirely.
  • Fix request parameter sanitization.

3.09

  • Fix optional usage tracking.
  • Fix an interoperability issue with other Divi module extender plugins.

3.08

  • Fix deprecation notice spam. Thanks to Ben Harper of 3dtek.xyz!

3.07

  • Fix missing ET_BUILDER_DIR . ‘layouts.php’.

3.06

  • Fix version checker options.

3.05

  • Update license terms.

3.04

  • Fix the issue wherein builder-fixes.js forces builder.js to be loaded in the header instead of in the footer. Special thanks to @kihoshin for helping to locate this error!

3.03

  • Better multisite support.
  • Remove the need to clear local storage in modern browsers to see the « Content Visibility » settings on Sections / Modules.

3.02

  • Fix distributable…

3.01

  • Fix « Currently Available Module-Specific Actions and Filters » tab not displaying available actions and filters in the Module Extender API Reference.

3.00

  • Add support for Visual Builder in Divi 3.x.

2.02

  • Fix Builder UI to handle ‘]’ characters in Content Visibility expressions.

2.0.0

  • Add Module Extender for Divi Builder functionality; see API page after upgrading under Tools -> Module Extender API Reference.
  • Add usage tracking. If you prefer not to submit your usage data, this can be disabled on the plugins page by clicking « Disable anonymous usage tracking ».

1.0.4

  • Add links to ratings and reviews to help spread the word.

1.0.3

  • Call load_plugin_textdomain().

1.0.2

  • Added i18n support.

1.0.1

  • Fix handling of double quotes in Content Visibility expression. Thanks to Dave Bullock of memberium.com!

1.0.0

  • Initial Release