• I put the following into the text widget:
    <?php if ( is_user_logged_in() ) {
    [standout-css3-button href=”<?php echo wp_logout_url( get_permalink() ); ?>”]Logout[/standout-css3-button]
    } else {
    [standout-css3-button href=”/#login-box”]Login[/standout-css3-button]
    }
    ?>

    It shows up like this on my website (where it says (Login) is where my login button is and it works fine):
    Logout } else { (Login) } ?>

    I have put ‘add_filter(‘widget_text’, ‘do_shortcode’)’ into the functions.php file for my theme so that short codes work in widgets.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator t-p

    (@t-p)

    What is the question?

    Hi Tom,

    See if this code works for you:

    <?php if ( is_user_logged_in() ) {
    do_shortcode( ‘[standout-css3-button href=”‘ . wp_logout_url( get_permalink() ).'”]Logout[/standout-css3-button]’);
    } else {
    do_shortcode(‘[standout-css3-button href=”/#login-box”]Login[/standout-css3-button]’);
    }
    ?>

    Thread Starter Tom555444

    (@tom555444)

    Thanks for your help!

    My pleasure! Glad it was helpful.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘if logged in’ is closed to new replies.