Reputation:
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>
Upvotes: 0
Views: 1173
Reputation:
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;
}
Upvotes: 3