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) and the Divi Builder plugin, version 3 or higher! Developer Filters Expression Validation Filters The following filters allow developers to customize expression validation behavior. Add these filters in your theme’s functions.php or in a custom plugin. content_visibility_for_divi_builder_blocked_functions Filter the array of blocked function names. Functions in this list will cause an expression to fail validation. All comparisons are case-insensitive. Example – allow file_get_contents (blocked by default): add_filter( 'content_visibility_for_divi_builder_blocked_functions', function( $functions ) { return array_diff( $functions, array( 'file_get_contents' ) ); } ); Example – block an additional function: add_filter( 'content_visibility_for_divi_builder_blocked_functions', function( $functions ) { $functions[] = 'my_dangerous_function'; return $functions; } ); content_visibility_for_divi_builder_allowed_tokens Filter the array of allowed PHP token types (T_* constants). Tokens not in this list will cause an expression to fail validation. This is an advanced filter – consult the PHP tokenizer documentation before modifying. Example – allow the T_VARIABLE token type (blocked by default, use with caution): add_filter( 'content_visibility_for_divi_builder_allowed_tokens', function( $tokens ) { $tokens[] = T_VARIABLE; return $tokens; } ); content_visibility_for_divi_builder_allowed_chars Filter the array of allowed single-character tokens. Characters not in this list (such as =, ;, {, }, `, @, &, |, ~, ^) will cause an expression to fail validation. Example – allow the & character for bitwise operations: add_filter( 'content_visibility_for_divi_builder_allowed_chars', function( $chars ) { $chars[] = '&'; return $chars; } ); content_visibility_for_divi_builder_allowed_callables Filter the array of callables (function names and Class::method static-method entries) the validator considers known-safe. Anything not on the allowlist (and not on the blocked_functions denylist) is treated as an “Unknown callable” error. Names are normalized (leading \ stripped, namespace\ keyword prefix stripped, lowercased) before comparison, so \My\Namespace\Class::method, My\Namespace\Class::method, and namespace\My\Namespace\Class::method all match the same allowlist entry. The default list ships with WordPress conditional tags (is_user_logged_in, current_user_can, is_admin, etc.). The Expression Validation tab’s content scanner generates a ready-to-paste snippet for this filter pre-populated with every custom callable currently in your content. Example – allowlist a theme helper and a static service method: add_filter( 'content_visibility_for_divi_builder_allowed_callables', function( $callables ) { $callables[] = 'mytheme_should_be_visible'; $callables[] = 'MyTheme\Visibility\Service::checkUser'; return $callables; } );
Shed Menu
Shed Menu adds visibility conditions to WordPress navigation menu items. You can show or hide each item based on three conditions: Login status (logged in / logged out / everyone) Date range (start datetime, end datetime) User roles (administrator, editor, author, contributor, subscriber, or custom roles) All conditions are optional and combined with AND logic. This plugin reads the current user’s role information via wp_get_current_user() to evaluate role-based conditions. Three ways to use Standard menus — Open Appearance → Menus, expand any item, and set the conditions inline. Hand-coded themes — Use the helper function shedmenu_visible() in your header.php or other template files. Block editor — Wrap any blocks in the “Shed Menu — Conditional” block to show/hide them based on the same conditions. Helper function example 'in' ] ) ) : ?> My Page Shortcode example [shedmenu_visible login="in" start="2026-04-01" end="2026-04-30" roles="administrator"] This content is only visible to administrators between April 1 and April 30. [/shedmenu_visible] 日本語の説明 WordPress 標準ナビゲーションメニューに、メニュー項目単位の表示条件を追加します。 ログイン状態(ログイン中 / ログアウト中 / 全員) 表示期間(開始日時・終了日時) ユーザーロール(管理者 / 編集者 / 投稿者 等) 全ての条件は任意で、AND 条件で組み合わされます。 外観 → メニュー画面で各項目に条件を設定できます。テーマで wp_nav_menu() を使わず HTML 直書きしている場合は shedmenu_visible() ヘルパー関数を使ってください。Gutenberg では「Shed Menu — Conditional」ブロックで任意のブロック群を条件表示にできます。 Third-Party Services This plugin does not connect to any external services. All processing happens on your own server.