add span to wp_nav_menu widget

Filter ‘walker_nav_menu_start_el’ and replace the link text. Prototype, not tested: add_filter( ‘walker_nav_menu_start_el’, ‘wpse_56028_title’ ); function wpse_56028_title( $item ) { return preg_replace( ‘~(<a[^>]*>)([^<]*)</a>~’, ‘$1<span>$2</span></a>’, $item); }

Custom Post type menu highlighted in the archive/post

You have it almost right. Try the following: function add_active_classes($classes = array(), $menu_item = false){ global $wp_query; if(in_array(‘current-menu-item’, $menu_item->classes)){ $classes[] = ‘current-menu-item’; } if ( $menu_item->title == ‘product’ && is_post_type_archive(‘product’) ) { $classes[] = ‘current-menu-item’; } if ( $menu_item->title== ‘product’ && is_singular(‘product’) ) { $classes[] = ‘current-menu-item’; } return $classes; } add_filter( ‘nav_menu_css_class’, ‘add_active_classes’, 10, … Read more

wp_nav_menu show 1 item only

Why would you only want to display one item from a menu of many items? You can create additional menus by registering them in your functions.php file and then associating then in the Appearance -> Menus area of the WP-Admin. http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus

Output menu navigation in php file

You would require the path to wp-blog-header.php to access WordPress functionality in a standalone PHP file. So your justthemenu.php file should contain the following code. <?php require(‘/wp-blog-header.php’); wp_nav_menu( array( ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’ ) ); ?>

wp_nav_menu – show children of current menu item only?

Don’t know if this is the best way but i would go like this- 1) Hook into wp_nav_menu_objects filter. The function will recieve a list of all menu-items. These menu items will already have the information regarding current page or current page’s ancestor(do a var_dump once) 2) From these menu items, unset all the menu … Read more