Output Post ID for all nav_items

html mark up for navigation will look like this <ul id=”menu-res” class=”main-menu”><li id=”menu-item-72″ class=”menu-item menu-item-type-custom menu-item-object-custom menu-item-72″><a href=”#home”>Home</a></li> <li id=”menu-item-238″ class=”menu-item menu-item-type-custom menu-item-object-custom menu-item-238″><a href=”#services”>Services</a></li> <li id=”menu-item-73″ class=”menu-item menu-item-type-custom menu-item-object-custom menu-item-73″><a href=”#about”>About</a></li> <li id=”menu-item-75″ class=”menu-item menu-item-type-custom menu-item-object-custom menu-item-75″><a href=”#skills”>Skills</a></li> <li id=”menu-item-346″ class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-346″><a href=”http://www.yourstorepick.com/pro-site/”>Pro Site</a></li> <li id=”menu-item-347″ class=”menu-item menu-item-type-custom menu-item-object-custom menu-item-347″><a href=”http://www.yourstorepick.com/wp-signup.php?pro-site=1″>Sign up</a></li> … Read more

How to hightlight all ancestor menu items of a child page NOT displayed in menu

You are checking against just one parent item. Instead, you might check against all of the parents <?php //in functions.php add_filter(‘nav_menu_css_class’, ‘highlight_portfolio’, 12, 2); function highlight_portfolio($classes, $item) { $parents = get_post_ancestors(); if ( 0 < count($parents) ) { if ( in_array( $item->object_id, $parents ) { array_push( $classes, ‘current-menu-ancestor’ ); } } return $classes; } Notice … Read more

Theme for subcategories

You could use the template_redirect hook to check and see if your post is a category and then whether it is a sub-category … and if so, force a different template. For example (assuming you are using wordpress categories) function my_maybe_override_category_template( $template ) { # Make sure you are about to show a category term … Read more

parse_tax_query causing Navigation Menu To Disappear

Query parsing happens on every query run on a page, not just the main query. Your parse_tax_query is modifying the query for menu items in your menu. Check is_main_query() to make sure you only change the main query: function no_child_terms($query) { if( !is_admin() && $query->is_main_query() ){ $query->tax_query->queries[0][‘include_children’] = 0; } } add_action(‘parse_tax_query’, ‘no_child_terms’);

Walker Class: Output Parent Description and Featured Image right after sub-menu?

Figured it out as I wrote out my question. Love when that happens. Here is the solution if someone needs this for the future. I simply just wrapped the desired output in a conditional to match the depth I needed. Viola> if ( 0 == $depth ) { $item_output .= “\n$indent<div class=\”dropdown\”><div class=\”container\”><div class=\”thumbnail\”>”.$thumbnail.”</div><div class=\”nav-info\”>” … Read more

Using Different wp_nav_menu theme_location based on page id (or a parent id)

The best solution would be to allow a user to choose the nav menu location when adding/editing a page. Use a meta box with a dropdown (select) with all the available locations, and then save the selected location in a custom field: /** * Register the meta box. */ function wpse_183868_page_nav_menu_meta_box_register() { add_meta_box( ‘wpse_183868_page_nav_menu’, ‘Nav … Read more