• Resolved padmanabham

    (@padmanabham)


    Hi,

    i want to login/logout main menu bar item, when any user click login menu item after login it will show the logout button in the menu bar. it is not like a toggle. so how can i write the code, i am using the bridge theme.

    any one can help me……

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor etoilewebdesign

    (@etoilewebdesign)

    Hi padman,

    This could be achieved by making use of our available public functions. Displaying different menus based on whether or not someone is logged in is something that is discussed in our tutorial video for the public functions, which you can watch here: https://www.youtube.com/watch?v=bKiJAjq7PhQ.

    Thread Starter padmanabham

    (@padmanabham)

    Hi Etoile,

    i was added code like this in the theme function.php file, it show fatal error. any modification in this code, please help me

    add_filter( ‘wp_nav_menu’, ‘wti_loginout_menu_link’, 10, 2 );

    function wti_loginout_menu_link($items, $FEUP )
    {
    $FEUP = new FEUP_User;

    if($FEUP -> Is_Logged_In())
    {
    $items .= wp_nav_menu(array(‘menu’ => ‘Login’));
    }
    else
    {
    $items .= wp_nav_menu(array(‘menu’ => ‘Top-Menu’));
    }

    return $items;
    }

    Thank you

    Plugin Contributor etoilewebdesign

    (@etoilewebdesign)

    Hi,

    The code should be added directly to the template file that you want to change (e.g. header.php, page.php, single.php, etc.)

    Thread Starter padmanabham

    (@padmanabham)

    Hi Etoile,

    Thank you so much for replaying.

    i was added code in heade.php and page.php but it is showing duplicate menu in the page.
    this is i added code like this.
    <?php

    $FEUP = new FEUP_User;

    if($FEUP -> Is_Logged_In())
    {
    wp_nav_menu(array(‘menu’=>’Login’));
    }
    else
    {
    wp_nav_menu(array(‘menu’=>’Top-Menu’));
    }

    ?>

    Please check this is my website url : https://hurify.co/

    user name : pakki1246@gmail.com
    password : gagan@143

    Thank you

    Plugin Contributor etoilewebdesign

    (@etoilewebdesign)

    Hi,

    It looks like you’re using the code in the right way. Did you delete the spot in your theme template files where the menu is currently being generated? Not being familiar with your theme or site, I don’t know exactly how or where the menu is generated, but it would seem to me that you would need to delete the original menu if you’re going to be adding it back in with the new code.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Login/logout menu’ is closed to new replies.