WordPress.org

Forums

Hide some page links for guests? (4 posts)

  1. kronowski
    Member
    Posted 5 years ago #

    Hi!

    I would like to hide some page links for guests visiting my page. The pages itself is alredy hidden thanks to the plugin "member acess". But the links is still visible in the menu.

    I belive the code below would work for me. But I'm looking for a plugin that can do the same thing. Would be a lot easier for me to maintain the site then.

    <ul>
    <?php if ( $user_ID ) : ?>
    <?php wp_list_pages('depth=1&title_li=&exclude=' ); ?>
    <?php else : ?>
    <?php wp_list_pages('depth=1&title_li=&exclude=5' ); ?>
    <?php endif; ?>
    </ul>

    Appreciate any help.

  2. Jonathan Dingman
    Member
    Posted 5 years ago #

    You probably want to look at is_user_logged_in()

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

    so something like...

    if ( is_user_logged_in() ) { ... }
    else { ... }
  3. kronowski
    Member
    Posted 5 years ago #

    Thank you for your reply.
    But what I'm relly looking for is a plugin that can do the job for me :)

    I would prefer a plugin because right now when the site is new there's a lot of changes and it's a lot of work if I have to change the code all the time.
    And as I understand it, for an easy upgrade process it's better to have plugins.

  4. Jonathan Dingman
    Member
    Posted 5 years ago #

    there's no plugin available that will just do it all for you.

    it'll be something you need to code onto the site manually, it's a very specific need

Topic Closed

This topic has been closed to new replies.

About this Topic