Tag Info

New answers tagged

0

This is how I added data attribute to my menu It simply adds data-title="menu-title" to each link on my main nav, change it to adapt to your need. You don't actually need to use Nav Walker to add this add_filter( 'nav_menu_link_attributes', 'cfw_add_data_atts_to_nav', 10, 4 ); function cfw_add_data_atts_to_nav( $atts, $item, $args ) { ...


1

No. Unfortunately you're looking at a walker, or a custom replacement function, as described here: http://stackoverflow.com/questions/12353076/wp-list-pages-isnt-showing-title-attribute


0

You can modify your menu by using walker. include('subMenu.php'); $menu = wp_nav_menu( array('menu' => 'YOUR-MENU-NAME','menu_class' => 'megamenu','walker' => new subMenu)); create a file subMenu.php in theme folder add below code. <?php class subMenu extends Walker_Nav_Menu { function end_el(&$output, $item, $depth=0, $args=array()) ...


0

That's problem with your css. Add this in your style.css. ul.children { margin-left: 3em; }


0

Another option would be to take a look at what the $item variable includes within thestart_el() function. For example, the menu-order property might be of use to you. function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { echo $item->menu_order; } This might output something like: 1234 if you have four menu items.



Top 50 recent answers are included