WordPress.org

Support

Support » Plugins and Hacks » Hacks » Conditional Tags on User or User Role/Type

Conditional Tags on User or User Role/Type

  • I am trying to check if the logged in user is the same as the author who created the post/apge. If this results in true then I want to display some text, if not something else. for now I’m using :

    [ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]

    <?php if(is_user_logged_in() == the_author() ) : ?>
      <p>You wrote this post</p>
    <?php else: ?>
      <p>You didn't write this post</p>
    <?php endif ?>

    I also want to use the above to check the user role.
    Turns out, it nothing works.
    Help appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional Tags on User or User Role/Type’ is closed to new replies.
Skip to toolbar