Adding a unique class to wp_nav_menu

Check out the section titled Adding Conditional Classes to Menu Items on the wp_nav_menu Codex page. This should give you a pretty good overview for adding classes to menu items using the nav_menu_css_class filter. For what you asked to do, which is add menu_element to the class attribute for both the menu item with ID … Read more

Add qtranslate language select box to menu [closed]

In my header.php I added the following <div style=”float: right; margin: 7px 15px 0 0;”> <?=qtrans_generateLanguageSelectCode(‘dropdown’);?> </div> <?=..?> is the same as <?php echo … ?> or <?php function(); ?>, but I prefer the shortcode just next to: <?php ct_primary_nav_menu(); ?>

Auto Filled Custom Menus for Custom Post Types?

I’m not quite clear on what you’re trying to do, but I’ll just take a shot in the dark. Try messing around with custom fields. You could have a custom field with a boolean value. Then in your template, you would check to see if the post has that value. So if that value returns … Read more

Nav Menu Display

Register your menus in functions.php like so: if ( function_exists( ‘register_nav_menus’ ) ) { register_nav_menus( array( ‘my_main_menu’ => ‘Main Menu: description’, ‘my_sub_menu’ => ‘Sub Menu: description’, ‘my_footer_menu’ => ‘Footer Menu: description’ ) ); } Add the menu to the template like so: <?php wp_nav_menu( array( ‘sort_column’ => ‘menu_order’, ‘theme_location’ => ‘my_main_menu’, ‘container_class’ => ‘main-menu’ ) … Read more

if is_home(), change class of menu-item-225 of wp_nav_menu

Rather than adding a class, just add a second selector to your .current_menu_item style of .home .menu-item-225. Not ideal, but for a single case, I think it’s completely appropriate. (This assumes that you’re using body_class() on your <body> element, but you should be doing that anyway.)

Change sub-menu css class

if you don’t want to use a custom menu walker, you can use the classes wp already puts out. If you add a class to the menu item you know will have a extra ul, you’ll have something like this <ul> <li class=”menu-item menu-item-1″>Item 1</li> <li class=”menu-item menu-item-2″>Item 2</li> <li class=”sub-1 menu-item menu-item-3″>Item 3 <ul … Read more