Site icon Hip-Hop Website Design and Development

How can I add a login/logout hyperlink within the sub-nav of my web site?

Utilizing the code beneath I used to be in a position to get a login/logout button engaged on my navigation. This code makes it in order that it shows on my foremost navigation and I simply wished it to look as a sub-nav merchandise once you hover our "Users" hyperlink.

Is that this potential by making any adjustments to the code beneath?

Thanks!

perform my_account_loginout_link( $objects, $args ) {
    if (is_user_logged_in() && $args->primary-menu == 'locations-divided-menu-right-navigation') { //change your theme registered menu title to go well with
        $objects .= '<li><a href="'. wp_logout_url( get_permalink( wc_get_page_id( 'myaccount' ) ) ) .'">Log Out</a></li>'; //change logout hyperlink, right here it goes to 'store', it's possible you'll wish to put it to 'myaccount'
    }
    elseif (!is_user_logged_in() && $args->primary-menu == 'locations-divided-menu-right-navigation') {//change your theme registered menu title to go well with
        $objects .= '<li><a href="' . get_permalink( wc_get_page_id( 'myaccount' ) ) . '">Log In</a></li>';
    }
    return $objects;
}```