0

I want to add a extra item like my logo before HOME item on the main nav.

My Wordpress menu looks like this

HOME | ABOUT | BLOG | CONTACT

    $nav_args = array(
    'theme_location' => 'nav',
    'container' => 'none',
    'menu_class' => 'level-1',
    'depth' => apply_filters( 'yit_main_nav_depth', 3 ),
          );


    if ( has_nav_menu( 'nav' ) )
        $nav_args['walker'] = new YIT_Walker_Nav_Menu();

    wp_nav_menu( $nav_args );

this is the view

 <div id="nav">
  <div class="container">
    <?php do_action( 'yit_main_navigation') ?>
  </div>
 </div>
2

1 Answer 1

3

I have solve this by adding the following code into my function.php

add_filter( 'wp_nav_menu_items', 'add_logo_nav_menu', 10, 2 );
function add_logo_nav_menu($items, $args){
$newitems = '<li><a title="logo" href="#">LOGO</a></li>';
    $newitems .= $items;

return $newitems;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.