• ananddevops

    (@ananddevops)


    Hello,

    Before I state my issue, I would like to mention, that I am using Elementor free and try to achieve my requirement using WordPress page templates.

    So, I have a login page ready – here . I need to show Login button conditionally i.e
    1. That is when a user is not logged into the site, show – Login button section
    2. When user is logged in the site, show – User already logged in.

    If I were to use page template, the following code would work:

    <?php if ( is_user_logged_in() ) { 
       wp_loginout();
    } else {
        echo 'User already logged in';
        wp_loginout();
    } ?>

    But my page is created using Elementor, and I am not using the WordPress login page, so wp_loginout(); will not work. So how do I achieve the same? Can I create an elementor page template?

    Please do suggest ways to achieve the same.

    Thanks,
    Anand

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show Login Button conditional to if user is logged in’ is closed to new replies.