Auto Submenu

The default custom menu in WordPress only allows checking the “Automatically add new top-level pages” (Appearance > Menus) or adding a Navigation block with all pages and all child pages (Appearance > Editor).

With Auto Submenu you get extra functionality to automatically include child pages into the menu.

NEW: ASM now provides support for the Customizer via Appearance > Customize
NEW: ASM now provides support for Full Site Editing with the Gutenberg Block Editor via Appearance > Editor

Using it

Enable the plugin and go to Appearance > Editor.

For each Page in your menu, you now have the following extra configuration options:

  • Add child pages as submenu y/n;
  • child pages are ordered ascending by Menu Order;
  • specify the (maximum) nesting depth of children you want to show (max 3);
  • specify the title for the child pages. For this you can use %post_title, %post_author and other wildcards, see ‘Other Notes > Wildcards’. Default value: %post_title

Via Appearance > Menus and Appearance > Customize you also get the following option:

  • Check the “Automatically add new top-level and all its child pages to this menu (Auto Submenu)”-checkbox.
  • If this option is checked, all top-level pages will automatically be added and will automatically have all child pages added as submenu.

With the Free version you cannot control the nesting depth of the child pages, all subpages are added, regardless the depth of the page tree.

Wildcards

You can control the title of the menu items generated by the plug-in with the following wildcards:

  • %post_title
  • %post_author
  • %post_date for the unformatted post date: 2012-11-10 18:14:23
  • %post_date() for a formatted post date with the following default formatting: November 10th, 2012
  • %post_date(<your formatting here>) for custom date formatting. Example: %post_date(l jS of F Y, h:i:s A). See https://codex.wordpress.org/Formatting_Date_and_Time for formatting options.
  • %post_date_gmt
  • %post_date_gmt()
  • %post_date_gmt(<your formatting here>)
  1. Go to plugins in your dashboard and select “Add New”
  2. Search for “Auto Submenu”
  3. Install and Activate the plugin

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

How do I use it?

Here’s a walkthrough:

  1. Create a page with title “Page 1”
  2. Save the page
  3. Create a child page with title “Child Page 1” and parent “Page 1”
  4. Save the child page
  5. Go to Appearances > Menus (or via Appearance > Customize or Appearance > Editor, in WordPress 5.4 or higher)
  6. Add your page named “Page 1”
  7. Open the menu item and check “Automatically create submenu with child pages”
  8. Save the menu

If you now look at your website, “Page 1” has a submenu with “Child Page 1” below it. Add additional child page and you will automatically see these additional child pages in the menu.

Missing CSS classes

The CSS class ‘current-post-ancestor’ is not applied correctly. This is a bug in WordPress that I have reported here: https://core.trac.wordpress.org/ticket/32918 This is not something I am able to fix in the plugin, it has to be fixed in WordPress. I’m sorry for the inconvenience.

Performance issues

The plugin is potentially very expensive, especially when you have a lot of pages and child pages.

The solution would be to cache the menu using transients, as reported here https://wordpress.org/support/topic/performance-problem-many-database-queries?replies=11#post-7829450

$my_cached_menu = get_transient( ‘my_cached_menu’);

if( $my_cached_menu === false )

{

$my_cached_menu = wp_nav_menu( … );

set_transient( “my_cached_menu_”, $my_cached_menu, YEAR_IN_SECONDS );

}

echo $my_cached_menu;

Can’t see it working in any way

Problem: “I can’t see what effect it has had. Nothing has changed (not that I can see) in the Appearance > Menu/Customize/Editor pages. It’s just like before.”

If you are using a recent version of Auto Submenu and an updated version of WordPress, the problem can only occur due to your theme or other plugins conflicting with Auto Submenu. Please disable all themes and plugins except ASM; verify that the ASM fields show; enable other plugins and themes one by one to determine which plugin/theme conflicts with ASM.

Note: A theme must either call wp_nav_menu() or apply_filters( ‘wp_nav_menu_objects’, … ) for ASM to be triggered.

Does not work for scheduled pages

Automatically adding future dated child pages doesn’t work due to what appears to be a bug in the WordPress core. Future dated top-level pages don’t seem to get added to custom menus either.

×
نظری برای این آیتم موجود نیست.
0 0 رای ها
امتیازدهی
اشتراک در
اطلاع از
0 نظرات
قدیمی‌ترین
تازه‌ترین بیشترین رأی
نسخه حجم فایل SHA256 تغییرات دانلود
1.0.5 166 کیلوبایت -
دانلود
×
★★★★★
★★★★★
4.0 /5 (25 نظر)

قیمت:

رایگان

نگارش

1.0.5

آخرین انتشار

12 اردیبهشت 1405

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

4 ماه پیش

نصب های فعال

2,000+

نگارش وردپرس

وردپرس 5.4+

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

وردپرس 6.9.4

نگارش PHP

PHP 7.4+

نسخه ها

1 نسخه