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).
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).
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
To be honest, I don’t really know why my solution works, but it does 😂 I based my snippet on this solution and tweaked the output to my needs: Custom nav walker with different output depending on depth class sublevel_wrapper extends Walker_Nav_Menu { // add classes to ul sub-menus function start_lvl( &$output, $depth = 0, … Read more
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
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
I downloaded this plugin and took a look and it does work as advertised for me. The function it uses for displaying the page list is: wp_list_pages(array( ‘sort_column’=>’menu_order’, ‘depth’=>’4’, ‘title_li’=>”, ‘exclude’=>$exclude )); ?> Which is very straightforward and does very explicitly order the items via menu_order. However, because it’s a core function subject to actions … Read more
Filter nav_menu_link_attributes: add_filter( ‘nav_menu_link_attributes’, ‘wpse_100726_extra_atts’, 10, 3 ); function wpse_100726_extra_atts( $atts, $item, $args ) { // inspect $item, then … $atts[‘custom’] = ‘some value’; return $atts; } This works with WordPress < 3.6: add_filter( ‘walker_nav_menu_start_el’, function( $item ) { $parts = explode( ‘>’, $item ); $out = array (); foreach ( $parts as $i => … Read more
As recommended in a similar post: https://wordpress.stackexchange.com/a/156494/74343 1.) Create the menus as you want them, and name them as you like, as an example “mobile-menu” and “desktop-menu“. 2.) In your child theme in the header.php you could switch according to the wp_is_mobile() flag like this: if ( wp_is_mobile() ) { wp_nav_menu( array( ‘menu’ => ‘mobile-menu’ … Read more
PHP way: Add the following to your functions.php file. Filter nav_menu_link_attributes: add_filter( ‘nav_menu_link_attributes’, ‘my_menu_atts’, 10, 3 ); function my_menu_atts( $atts, $item, $args ) { // Provide the id of the targeted menu item $menu_target = 123; // inspect $item if ($item->ID == $menu_target) { // original post used a comma after ‘modal’ but this caused … Read more
I somewhat suck with admin stuff so test this carefully. I had some issues with users not coming up in dropdown, but it fails with default meta box as well – probably because of my messed up test stack. add_action( ‘admin_menu’, ‘remove_author_box’ ); add_action( ‘post_submitbox_misc_actions’, ‘author_in_publish’ ); function remove_author_box() { remove_meta_box( ‘authordiv’, ‘post’, ‘normal’ ); … Read more