wp_nav_menu() mark current item ancestor of custom post type

I do the following, it can be lengthy if you have many post types, feel free to edit it however: /** Edit Nav Menu calsses **/ function custom_wp_nav_classes($classes, $item){ global $post; $page_blog = get_option(‘page_for_posts’); if(is_tax(‘my_taxonomy_name_here’) || is_singular(‘my_post_type_name_here’)){ /** Remove Active Class from Blog **/ if($item->object_id == $page_blog) $classes = array_filter($classes, “remove_parent”); /** Page ID of … Read more

Two Navigation Menus – secondary nav is including main nav

In your theme’s functions.php did you register a new WP Menu ? by using a code like this: register_nav_menus( array( ‘secondary’ => __( ‘Secondary Navigation’, ‘twentyten’ ), ) ); And after that in your theme’s header.php under <div id=”access” role=”navigation”> you should add <?php wp_nav_menu( array( ‘container_class’ => ‘menu-header-secondary’, ‘theme_location’ => ‘secondary’ ) ); ?>

Removing “Sub-menus” from My Sites Drop-down in Admin Bar

Old question but I just came accros a fix. I hope it helps someone else. Add this to your theme functions.php file add_action( ‘wp_before_admin_bar_render’, ‘remove_mysites_comment_link’ ); function remove_mysites_comment_link () { global $wp_admin_bar; foreach ( (array) $wp_admin_bar->user->blogs as $blog ) { $menu_id_c=”blog-” . $blog->userblog_id . ‘-c’; $wp_admin_bar->remove_menu($menu_id_c); } }

Create self-populating menu and add extra divs to the menu layout

Your html structure should look like <ul class=”parent-class”> <li>Page 1</li> <li> <ul class=”child-class”> <li> Sub menu item 1</li> <li> Sub menu item 2</li> </ul> </li> </ul> WordPress should automatically add an “active” class to the active page then you should be able to style everything with css. Something like .parent-class li ul { Display:none; } … Read more

Custom Nav Walker to show siblings and children of current branch?

Well, as much as I prefer to have my own walker and control over the nav, I found a plugin that does exactly what I want: Advanced Menu Widget http://wordpress.org/extend/plugins/advanced-menu-widget/ Only tested slightly but its working just as I expected, just have to select “Only strictly related sub-menu” in the menu widget config. I should … Read more