Shed Menu

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

  1. Standard menus — Open Appearance Menus, expand any item, and set the conditions inline.
  2. Hand-coded themes — Use the helper function shedmenu_visible() in your header.php or other template files.
  3. Block editor — Wrap any blocks in the “Shed Menu — Conditional” block to show/hide them based on the same conditions.

Helper function example

<?php if ( shedmenu_visible( [ 'login' => 'in' ] ) ) : ?>
    <li><a href="/mypage/">My Page</a></li>
<?php endif; ?>

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.

  1. Upload the shed-menu folder to the /wp-content/plugins/ directory, or install via the Plugins screen in WordPress.
  2. Activate the plugin through the Plugins screen.
  3. Go to Appearance Menus, expand any menu item, and configure visibility conditions.

سوالات متداول

Does this work with caching plugins?

Login-based visibility is evaluated per request. If you use a page caching plugin, make sure it serves separate cached pages for logged-in vs logged-out users. Most caching plugins support this by default.

Does this conflict with other menu plugins?

Shed Menu uses the standard wp_nav_menu_objects filter and does not override menu rendering. It works alongside most menu plugins.

Why doesn’t the date condition work in the Navigation block (block theme)?

The Navigation block uses its own internal item structure that does not expose per-item post meta in a stable way. Use the “Shed Menu — Conditional” block to wrap navigation links instead.

What happens to my settings when I uninstall?

Uninstalling removes all visibility settings stored on menu items and plugin options. Deactivating without uninstalling preserves all settings.

Can I use custom roles?

Yes. The Roles field in the menu item editor lists all roles registered in your WordPress installation, including custom roles added by other plugins.

×
نظری برای این آیتم موجود نیست.
0 0 رای ها
امتیازدهی
اشتراک در
اطلاع از
0 نظرات
قدیمی‌ترین
تازه‌ترین بیشترین رأی
بازخورد (Feedback) های اینلاین
مشاهده همه دیدگاه ها
هیچ نسخه‌ای برای این آیتم موجود نیست.
بدون امتیاز

قیمت:

رایگان

نگارش

آخرین انتشار

2 خرداد 1405

آخرین بروزرسانی

4 هفته پیش

نصب های فعال

-

نگارش وردپرس

وردپرس 6.0+

تست شده از نسخه

وردپرس 7.0

نگارش PHP

PHP 8.1+

نسخه ها

0 نسخه