• pdstudio

    (@pdstudio)


    Hy,
    I want to make a logout link for the logged in users.
    I inserted this code to my template file:
    <?php if ( is_user_logged_in() ) { echo "<a href=\"" . wp_logout_url( 'https://www.deependfx.com' ); ."\" title=\"Logout\">You are now logged in. Click here to log-out.</a> }; ?>
    but I get an error:

    Parse error: syntax error, unexpected ‘.’

    What am I doing wrong?

Viewing 1 replies (of 1 total)
  • Remove the semicolon after …deependfx.com’ );
    and add quotations and a semicolon after /a>“;
    and remove the last semicolon. That’s it ??

    <?php if ( is_user_logged_in() ) { echo "<a href=\"" . wp_logout_url( 'https://www.deependfx.com' ) . "\" title=\"Logout\">You are now logged in. Click here to log-out.</a>"; } ?>

    Or maybe more readable

    <?php if ( is_user_logged_in() ) { printf( '<a href="%s" title="Logout">You are now logged in. Click here to log-out.</a>', wp_logout_url( 'https://www.deependfx.com' ) ); } ?>

Viewing 1 replies (of 1 total)
  • The topic ‘IF logged in, show logout link doesnt work’ is closed to new replies.