I have the following lines of code in my functions.php file:
#-----------------------------------------------------------------#
# Custom menu
#-----------------------------------------------------------------#
if ( function_exists( 'register_nav_menus' ) ) {
register_nav_menus(
array(
'top_nav' => 'Top Navigation Menu',
'secondary_nav' => 'Secondary Navigation Menu <br /> <small>Will only display if applicable header layout is selected <a href="'. admin_url('?page=redux_options&tab=4') .'">here</a>.</small>'
)
);
}
//dropdown arrows
class Theme_Arrow_Walker_Nav_Menu extends Walker_Nav_Menu {
function display_element($element, &$children_elements, $max_depth, $depth=0, $args, &$output) {
$id_field = $this->db_fields['id'];
if (!empty($children_elements[$element->$id_field]) && $element->menu_item_parent == 0) {
$element->title = $element->title . '<span class="sf-sub-indicator"><i class="icon-angle-down"></i></span>';
$element->classes[] = 'sf-with-ul';
}
if (!empty($children_elements[$element->$id_field]) && $element->menu_item_parent != 0) {
$element->title = $element->title . '<span class="sf-sub-indicator"><i class="icon-angle-right"></i></span>';
}
Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
}
And the following lines of code in my header.php file:
<?php if(has_nav_menu('secondary_nav')) { ?>
<ul class="sf-menu">
<?php wp_nav_menu( array('walker' => new Theme_Arrow_Walker_Nav_Menu, 'theme_location' => 'secondary_nav', 'container' => '', 'items_wrap' => '%3$s' ) ); ?>
</ul>
<?php } ?>
Which displays a primary and more importantly regarding this issue, a secondary navigation menu:
I would like to add a login navigation hyperlink, just below the My Account hyperlink, and remove it if the user is logged-in.
When adding this using the Admin > Appearance > Menus settings...
It leaves the login navigation hyperlink there, even if the user is logged-in.
How would I be able to add a login navigation hyperlink to my secondary navigation menu, and remove it from the list once the user is logged in to the website, and if possible without an additional plugin?
Thank you.