Support » Plugins and Hacks » Hacks » Execute PHP wp_login_url on single post?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Sorry, forgot the backticks. Here’s the code I’m trying to execute-

    <a href="<?php echo wp_login_url( get_permalink() ); ?>" title="Login">sign in</a>

    That should work unless you use one of redirection plugins (eg. Peter’s Login Redirect). I understand that you want to use it this way:

    <?php if ( is_user_logged_in() ) { ?>
    ... protected content ...
    <?php } else { ?>
    You must <a href="<?php echo wp_login_url( get_permalink() ); ?>" title="Login">sign in</a> to see this post.<?php } ?>

    I figured out the problem – I was trying to execute it after a More tag, which I have since learned is ignored in single.php.

    I used shortcodes instead to make things work.

    Thanks for your help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Execute PHP wp_login_url on single post?’ is closed to new replies.