The default custom menu in WordPress only allows adding a
link that leads to a list of posts and pages belonging to a taxonomy (category, tag, etc). If you want to list the posts and pages
themselves and if you want Wordpress to do this automatically for you, then I hope you will find this plugin useful.
Also works for custom taxonomies and custom post types!
Using it
Enable the plugin and go to Appearance > Menus. Create your Custom Menu. Add a taxonomy (category/tag/custom) to the menu. Next, you can choose if you would like to replace the category by the posts or pages themselves.
For each Category or Post Tag item in the menu, you now have the following extra configuration options:
- create submenu containing the posts in the category y/n;
- specify the (maximum) number of posts you want to show for this item (1 to 10);
- their ordering ascending or descending by Title or Date;
- specify the title for the menu items. For this you can use %post_title, %post_author and other wildcards, see 'Other Notes > Wildcards'.
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 http://codex.wordpress.org/Formatting_Date_and_Time for formatting options.
- %post_date_gmt
- %post_date_gmt()
- %post_date_gmt(<your formatting here>)
1.4.0
Bugfix: On some mobile themes, the dropdown caret did not show. (As reported here:
https://wordpress.org/support/topic/mobile-sub-menu-3/, and here:
https://wordpress.org/support/topic/not-working-on-mobile-devices-16/)
Split Free and Premium version:
- Premium has extra wildcards that Free doesn't have.
- Premium allows expanding unlimited posts; Free is limited to 10 posts.
- Premium allows removing the original menu item; Free always shows the category, with the posts below it.
- Premium allows filtering out the subcategories; Free always returns posts in subcategories when the parent category is selected
- Premium supports HTML in the label field; Free only supports plaintext.
- Premium offers hooks to extend the plugin functionality; Free does not.
1.3.0
Now compatible with WordPress 5.7.
If you are on a WordPress version between 4.7 and 5.7.2, when encountering issues please report the WordPress version you're running.
1.2.4
1.2.3
- Hide the options when 'Create submenu ...' is not checked, thanks for contribution by websevendev
- Fix compatibility issue with 4.7, resulting in options not being shown.
1.2.2
- Allow users to plug-in their own wildcards to facilitate https://wordpress.org/support/topic/show-category-post_category?replies=3
- Edit readme to explain usage of the custom wp_nav_menu_item_custom_fields that several plugin authors have been using.
- Add example implementation to the sample extension that shows how to extend the CSS classes of the menu items
- Unit tests
1.2.1
1.2.0
- Fixed serious bug in versioning, which resulted in version 1.1 having no settings at all anymore. This fix has been tested with both both the upgrade path 1.0.1 -> 1.2 and upgrade path 1.0.1 -> 1.1 -> 1.2, both upgrade paths should be fined now. My sincere apologies to all who experienced this issue.
- Fixed debug errors as reported here https://wordpress.org/support/topic/undefined-index-56?replies=7
1.1
1.0.1
- Added hook wp_nav_menu_item_custom_fields for compatibility with other plug-ins adding fields to the Appearances > Menus page.
- Fix for CSS class bugs reported by brangelo in https://wordpress.org/support/topic/works-with-41-as-far-as-i-can-tell?replies=5.
- Bugfix: normal menu items that were below a menu item removed by cpcm, are now repositioned in the menu correctly.
- Bugfix for subcategories with a single post with setting remove="only if empty": "For example, I have a parent category A with sub categories A1, A2 and A3. I have all sub categories set to remove only if there are no posts. Subcat A1 displays with submenu of posts (2), subcats A2 and A3 do not display and their posts (1 each) show directly under the parent as posts links."
1.0
0.9.5
0.9.4
0.9.3
0.9.2
0.9.1
0.9
- Fixed CSS 'active' class problem: CSS classes are no longer copied from the parent menu item to the menu item for the posts/pages.
0.8
- Added the option to keep or remove the original menu item. Initially, the original menu item was replaced by the list of its posts, but now you can choose for yourself whether this should be done (always / only if there are no posts / never)
0.7.2
- Bugfix: Fixed invalid argument error reported by macrocurio in Plugin Support.
0.7.1
- Bugfix: Link Target, CSS Classes, Link Relationship (XFN) and Description weren't inherited from the original menu item. They are now.
0.7
- Added support for custom post types
- Fixed user_data bug
- Added date formatting options
0.6
- Added a bunch of wildcards: %post_feat_image (url only), %post_excerpt, %post_url, %post_date, %post_date_gmt, %post_status, %post_modified, %post_modified_gmt, %post_comment_count
0.5
- Enable custom taxonomies.
- Change plugin URL.
0.4
- Fix plugin bug for Tags, probably related to 3.2.2 update.
- Edit documentation
- Change some CSS to show checkbox next to label instead of above it.
- Edit text in menu item block to clarify use of custom fields.
0.3
- Extended the plugin for use of custom fields. Use a custom field with name 'my field' with wildcard %post_my_field. Note that if the post does not have this custom field, the wildcard is removed (it is not replaced by anything).
0.2
- Extended the plugin to post tags. Note that the plugin name has unfortunately not been changed to reflect this extension.
Added checkboxes, dropdowns and text fields to Appearance > Menu. It is now possible to:
- Enable/disable per taxonomy item whether you want to replace it by its posts
- Specify the (maximum) number of posts that should be displayed.
- Specify the ordering (Descending/Ascending) and the field to order by (ID, title, etc..)
- Set a title for the menu items. For this you can use the wildcards %post_title and %post_author.