Editing or filtering the output of the Genesis navigation

You could try to use the wp_nav_menu_args filter (untested): /** * Add the Menu_With_Data_Attr walker to the wp_nav_menu() used by genesis_do_nav() */ add_filter( ‘wp_nav_menu_args’, function( $args ){ if( isset( $args[‘menu_class’] ) && ‘menu genesis-nav-menu menu-primary’ === $args[‘menu_class’] ) { if( class_exists( ‘Menu_With_Data_Attr’ ) ) { $args[‘walker’] = new Menu_With_Data_Attr(); } } return $args; }); to … Read more

Add within the output of

According to the Codex, wp_nav_menu() has a couple parameters to add HTML or entities before and after the generated HTML. The parameters you want is link_before and link_after and to get the effect you’re after looks like this: ‘link_before’ => ‘<span class=”left_arrow”></span><span class=”middle_text”>’, ‘link_after’ => ‘</span><span class=”right_arrow”></span>’

Order by menu structure

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 … Read more

Create a Custom menu item fetched by Product Categories and Sub Categories

You could use the wp_get_nav_menu_items filter add_filter(‘wp_get_nav_menu_items’, ‘prefix_add_categories_to_menu’, 10, 3); Then you could do something like this: function prefix_add_categories_to_menu($items, $menu, $args) { // Make sure we only run the code on the applicable menu if($menu->slug !== ‘replace_this’ || is_admin()) return $items; // Get all the product categories $categories = get_categories(array( ‘taxonomy’ => ‘product_cat’, ‘orderby’ => … Read more

wp_nav_menu doesn’t generate parent/ancestor classes

This is part of code in _wp_menu_item_classes_by_context() that handles current class for pages: // if the menu item corresponds to the currently-queried post or taxonomy object } elseif ( $menu_item->object_id == $queried_object_id && ( ( ! empty( $home_page_id ) && ‘post_type’ == $menu_item->type && $wp_query->is_home && $home_page_id == $menu_item->object_id ) || ( ‘post_type’ == $menu_item->type … Read more

wp_nav_menu (secondary menu) not adding current classes

You need to assign the menu to the particular theme option from the admin end, Orelse use this code, wp_nav_menu( array( ‘menu’ => ‘second-menu’ ) ); Instead of, wp_nav_menu( array( ‘theme_location’ => ‘second-menu’ ) ); This will work.

Number of items in a menu

I was curious and decided to check it out, regardless if it’s relevant for a CSS problem 😉 I first peeked into the database tables to find more about the menu structure: Menu – building blocks Each navigational menu is registered as a term in the nav_menu taxonomy. Then when we add items to that … Read more

Main menu – get rid of titles?

The title is an accessibility attribute that helps users with screen readers. It is part of the recommended WC3 standard for navigation items. Just think about that before you decide to eliminate it because you find it annoying. Rather than modifying the PHP code, you could think about removing it after it’s loaded. It’s very … Read more

HTTPS page link in menu

You will need to convert the relative links to absolute links. You can do this in the wp_nav_menu_objects filter, which gets all menu items. Just edit the url property of each item. Another option would be to extend the default Walker_Nav_Menu with one that overrides start_el(), so you can modify the passed $item there before … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)