Forums

[resolved] Change page depending on whether user is logged in (5 posts)

  1. rowan.bradley
    Member
    Posted 2 years ago #

    About 9 months ago I designed some pages for a WordPress site that had different content if the user wasd logged in. The text of the page surounds the text to be shown if the user is _not_ logged in with [not_logged_in]...{/not_logged_in], and the text to be shown when he _is_ logged in by [logged_in]...[/logged_in]. It all works fine on my existing site, but I can't get it working on a new site, and I can't remember how I did it... I can't see any obvious plugin or anything. Can anyone suggest what is making this work?

    Thanks - Rowan

  2. ambrosite
    Member
    Posted 2 years ago #

    Couldn't you use this function to do something similar?

    http://codex.wordpress.org/Function_Reference/is_user_logged_in

    The body_class template tag, added in WP 2.8, also adds a 'logged-in' class to the body which could be used for conditional styling.

  3. nontechblogger
    Member
    Posted 2 years ago #


  4. stanzl
    Member
    Posted 2 years ago #

  5. rowan.bradley
    Member
    Posted 2 years ago #

    stanzl - you are a star! That's exactly what I needed to know. I've found the code I must have added to functions.php, so I can now add it to my new site and PROBLEM SOLVED!

    Many many thanks - Rowan

Topic Closed

This topic has been closed to new replies.

About this Topic