- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I’m looking for a plugin that creates a menu for post categories (with sub-categories in a submenu) automatically. I can do this manually, but it’s rather annoying to do that when you update categories frequently.
Wordpress can do that for pages, but nope, not categories.
Any ideas if such a plugin exists? or do I have to make my own?
I can, but as I said I would like to avoid manually editing the menus.
If I don’t have any other choice then yes I will do that manually
I was wondering the same thing and found these two plugins:
http://jamescollings.co.uk/wordpress-plugins/jc-submenu/
Allowing you to automatically populate wordpress menu items with post types, taxonomies, and pages.
&
https://github.com/wp-plugins/category-posts-in-custom-menu
This plugin automatically replaces selected Category / Post Tag / Custom Taxonomy links in a Custom Menu by a list of their posts/pages
At the same time I’m evaluating pro/cons of building a custom one using the following core functions:
register_nav_menu()
unregister_nav_menu()
wp_get_nav_menu_items()
wp_nav_menu_update_menu_items()
A basic snippet to build a menu from a query resut looks something like:
$menu_name = 'My Dynamic Menu';
$menu_exists = wp_get_nav_menu_object( $menu_name );
if( !$menu_exists){
$menu_id = wp_create_nav_menu($menu_name);
foreach($myQueryResult->posts as $post) {
wp_update_nav_menu_item($menu_id, 0, array(
'menu-item-title' => $post->post_name,
'menu-item-classes' => 'optionalClassName',
'menu-item-url' => get_permalink($post->ID),
'menu-item-status' => 'publish'
));
}
}