Put a wp_nav_menu inside another one

You could perhaps accomplish this via a custom walker, but I suggest you try a single menu containing submenus and display the submenus in other contexts by outputting just that branch of the main menu. see Display a portion/ branch of the menu tree using wp_nav_menu(), specifically this answer.

Primary and secondary menus

I am guessing you are gonna use pages or categories in the primary menu. The following code would need to be altered to work for custom taxonomies ( should work fine with custom post types also ). Put the following code in your themes functions.php: function km_dynamic_secondary_menu_reg() { global $km_nav_menus; $theme_location = ‘primary’; // replace … Read more

Customizing the a tag with Semantic UI

You are definitely on the right track, but wp_nav_menu will output a menu with a lot of containers and classnames; to keep it semantic in the terms of Semantic UI, you’ll be in good hands if you build the structure yourself. Get the name of the registered menu in the menu manager. Check register_nav_menu in … Read more

wp_nav_menu() loses ‘current-menu-*’ classes on single product page within category

Looking for a solution for the same problem, I came across this: add_filter( ‘nav_menu_css_class’, ‘add_parent_url_menu_class’, 10, 2 ); function add_parent_url_menu_class( $classes = array(), $item = false ) { // Get current URL $current_url = current_url(); // Get homepage URL $homepage_url = trailingslashit( get_bloginfo( ‘url’ ) ); // Exclude 404 and homepage if( is_404() or $item->url … Read more

Is there a way to keep a custom menu expanded when editing a custom post type?

I figured this out by putting the main menu slug into the show_in_menu key of the custom post type array like so: $args = array ( ‘labels’ => $labels, ‘hierarchical’ => FALSE, ‘description’ => $title . ‘s’, ‘supports’ => array( ‘title’ ), ‘show_ui’ => TRUE, ‘show_in_menu’ => ‘squirrels_inventory’, ‘show_in_nav_menus’ => TRUE, ‘publicly_queryable’ => TRUE, ‘exclude_from_search’ … Read more

Exclude one item from wp_list_pages( $args );

There’s a filter called wp_list_pages_exclude that you could possibly hook into (put this in your functions.php): function filter_wp_list_pages($exclude){ $exclude[] = 56; return $exclude; } add_filter(“wp_list_pages_excludes”, “filter_wp_list_pages”);

How to get a separate child menu?

Found the solution. Put this in your function.php file: // add hook add_filter( ‘wp_nav_menu_objects’, ‘my_wp_nav_menu_objects_sub_menu’, 10, 2 ); // filter_hook function to react on sub_menu flag function my_wp_nav_menu_objects_sub_menu( $sorted_menu_items, $args ) { if ( isset( $args->sub_menu ) ) { $root_id = 0; // find the current menu item foreach ( $sorted_menu_items as $menu_item ) { … Read more

How Do I Programmatically Better Organize Custom Post Type Menus?

On the function to register a new custom post type can you set this CPT as Submenu to a exist menu item. Use the param show_in_menu A example: register_post_type( ‘issue’, apply_filters( ‘wpit_register_issue_post_type’, array( ‘labels’ => $issue_labels, ‘rewrite’ => $issue_rewrite, ‘supports’ => $issue_supports, ‘taxonomies’ => $issue_taxonomies, ‘menu_position’ => 5, ‘public’ => TRUE, ‘show_ui’ => TRUE, ‘show_in_menu’ … Read more