Show Home Link In wp_nav_menu but only on primary menu

function my_page_menu_args( $args ) { if($args[‘theme_location’] === ‘primary’) $args[‘show_home’] = true; return $args; } add_filter( ‘wp_page_menu_args’, ‘my_page_menu_args’ ); The $args array also contains the theme location, so you can filter on that.

Bulk Custom Menu and Wp-Ecommerce

Goto Appearance -> Menus You can see all categories listed here including wp-ecommerce categories. Just create a new menu for your wp-ecommerce categories. Lets call it “ecomcategories”. You can call this menu in your theme using this code. <?php wp_nav_menu( array(‘menu’ => ‘ecomcategories’ )); ?> You can just drag and drop for sub menus. You … Read more

Inserting specific images inside navigation menu

This can be done easily with CSS. I would use the default wp_nav_menu() function to do the heavy lifting for you and build your menus under Appearance->Menus. If you click on screen options there is a checkbox under advanced menu properties called CSS Classes. Check that box. When you add a new menu item, you … Read more

How to test if blog page is active

There’s a site option for page_for_posts, so you might try if ( is_page( get_option(‘page_for_posts’) ) ). Edit: According to the Codex, is_home() will tell you if you’re on the blog page when you have a static front page: http://codex.wordpress.org/Conditional_Tags#The_Main_Page. I can’t test it right at this moment, but if that’s true, then that must be … Read more

How can I make this custom menu work?

You need to target the appropriate theme_location. Assuming you’ve defined multiple nav menu locations using register_nav_menus() in functions.php: <?php register_nav_menus( array( ‘primary-menu’ => ‘Primary Menu’, ‘secondary-menu’ => ‘Secondary Menu’ ) ); ?> Then you call wp_nav_menu() using the appropriate theme_location as defined above, along with any other relevant arguments, e.g.: <?php wp_nav_menu( array( ‘theme_location’ => … Read more

Problem with empty class attributes when running a filter on nav_menu_css_class

Unfortunately there is no filter which can overcome this issue. You have to override the start_el function of the walker. Here is the original source: $class_names = join( ‘ ‘, apply_filters( ‘nav_menu_css_class’, array_filter( $classes ), $item, $args ) ); $class_names=” class=”” . esc_attr( $class_names ) . ‘”‘; $id = apply_filters( ‘nav_menu_item_id’, ‘menu-item-‘. $item->ID, $item, $args … Read more