New Landing How can we help? Themeforest Theme Support Dante Add login / logout link to the mobile menu

Viewing 4 posts - 1 through 4 (of 4 total)
  • Posted in: Dante
  • #138007
    vasikgreif
    Member
    Post count: 21

    Hi,
    I tried to add login / logout links to the mobile menu, and cannot make this work. It works when the user is logged in, but doesn’t work if he’s loggewd out – in that case the filter isn’t even triggering. Here’s my code:

    /**
     * Add login / logout link to the menu
     */
    add_filter( 'wp_nav_menu_items', 'bs_login_logout_link', 10, 2 );
    function bs_login_logout_link( $items, $args  ) {
        var_dump($args);
        if( $args->theme_location == 'mobile_menu' ) {
            $loginoutlink = wp_loginout( 'index.php', false );
            $items .= '<li class="menu-item menu-item-type-post_type menu-item-object-page">'. $loginoutlink .'</li>';
            return $items;
        }
        return $items;
    }

    Any ideas?
    Thanks

    #138165
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    Can you try to use this filter ‘wp_page_menu’ instead ‘wp_nav_menu_items’ ?

    -Rui

    #138208
    vasikgreif
    Member
    Post count: 21

    Hmm, that doesn’t work neither…

    #138473
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please provide me wordpress admin login detail to inspect and resolve the issue.

    Thanks
    Mohammad

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register