Hi Guys
I have the following code in my functions.php for adding a login/logout to my menus
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
function add_login_logout_link($items, $args) {
ob_start();
wp_loginout('index.php');
$loginoutlink = ob_get_contents();
ob_end_clean();
$items .= '<li>'. $loginoutlink .'</li>';
return $items;
}
I need to change the code so it only applies to my secondary menu that is registered like so.
function register_main_menus() {
register_nav_menus(
array(
'primary-menu' => __( 'Primary Menu' ),
'secondary-menu' => __( 'Second Menu' )
)
);
}
How can I apply this login/logout code to just the Secondary Menu?
Part 2...
I'd also like to be able to select the order it is placed in. Right now I need it added to the end of the menu items.
Thanks