Tag Info

Hot answers tagged

1

I had a very similar issue. I needed to target a specific wp_nav_menu() and replace the a links with a class. Here is my solution in reference to the OP: function theme_add_menuclass( $classes, $args ) { if ( $args->theme_location == 'your-menu-location' ) { return preg_replace( '/<li /i', '<li class="your-class"', $classes ); } ...


1

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() ){ ...


1

You may be able to use a WP_Query on nav_menu_item since it is its own post type. I've never done this but maybe it would work like you need it to, worth a shot. There are three other possibilities: Option 1 - Get Your Nav Menu Items There's a functions called wp_get_nav_menu_items() which will return you an array of your menu items that you can then loop ...


1

There's an easier way with no markup changes and minimal CSS. Live demo/fiddle here, code below: <ul> <li>1a</li><li>2a</li><li>3a</li><li>4a</li><li>5a</li><li>6a</li> </ul> ul { list-style: none; margin: 0; padding: 0; text-align: right; } li { ...


1

you can follow the below Steps : Step 1 : In the wp-admin, go to Appearance -> Menus,put the class on the menu item here "CSS Classes (optional)". If you can't see the "CSS Classes (optional)" in the menu item, then there is "Screen Option" in the right top of the screen and there are the options "CSS Class" under "Show advanced menu properties". Step 2: ...



Only top voted, non community-wiki answers of a minimum length are eligible