Hide custom post type from nav menu manager

// set up the arguements for post type $labels = array(….); $args = array( ‘labels’ => $labels, ‘public’ => true, // display on menu and site ‘publicly_queryable’ => false, ‘show_ui’ => true, ‘query_var’ => false, ‘rewrite’ => false, ‘capability_type’ => ‘post’, ‘hierarchical’ => false, ‘menu_position’ => 111, ‘supports’ => array( ‘title’ ) ); // register … Read more

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

WordPress built in breadcrumb trail menu?

Breadcrumb NavXT will let you do that, it has a built in widget and supports just about everything WordPress can do (breadcrumbs spanning multiple sites in a multi site setup does not work, yet).

Overwriting Core WordPress Functions with Plugins

Not really, no. You can override built-in PHP functions, but not user-defined functions. However, all this function does is define a meta box. Why not define your own? Once you’ve got your own meta box defined and added, you can call remove_meta_box to remove the standard one: remove_meta_box( ‘add-POSTTYPENAME’, ‘nav-menus’, ‘side’); The meta box is … Read more

Bootstrap drop down menu with wp_nav_menu

You will need to write a custom walker extending Walker_Nav_Menu, more or less like so: class My_Custom_Nav_Walker extends Walker_Nav_Menu { function start_lvl(&$output, $depth = 0, $args = array()) { $output .= “\n<ul class=\”dropdown-menu\”>\n”; } function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { $item_html=””; parent::start_el($item_html, $item, $depth, $args); if ( $item->is_dropdown … Read more

Show specific menu item from wp_nav_menu based on id

If I understand what you want correctly, you can do this with CSS. You’ll call wp_nav_menu normally and let it generate all of the links, but then you’ll hide all of them except for the submenu of the current page. You’re CSS would look something like this, #sidebar ul.menu li { display: none; } #sidebar … Read more

How do you get the current-menu-item ID?

A little late perhaps, but there is one more way of doing it: $menu = wp_get_nav_menu_items($menu_id,array( ‘posts_per_page’ => -1, ‘meta_key’ => ‘_menu_item_object_id’, ‘meta_value’ => $post->ID // the currently displayed post )); var_dump($menu[0]->ID); Since menu items are post-types you are able to use all the WP-Query params, even a meta query. The code above selects all … Read more