Hi Guys
I want to remove the "Home" menu item from custom menus that appear in a "custom menu" sidebar widget.
I've found the code that appears to be adding it to all my menus, including the top menu area (I want "Home" kept there)
// Add home link to menus
function new_nav_menu_items($items) {
$homelink = '<li class="home"><a href="' . home_url( '/' ) . '">' . __('Home') . '</a></li>';
$items = $homelink . $items;
return $items;
}
add_filter( 'wp_nav_menu_items', 'new_nav_menu_items' );
add_filter( 'wp_list_pages', 'new_nav_menu_items' );
How would I change this code so that it will only add "Home" to the custom menu if it's in the main-nav position (refer my menu register code below)
// Register Custom Menu Function
function register_custom_nav() {
if (function_exists('register_nav_menus')) {
register_nav_menus( array(
'main-nav' => __( 'Main Navigation', 'themify' ),
'footer-nav' => __( 'Footer Navigation', 'themify' ),
) );
}
}
Thanks for your help.