• Resolved mc_raz

    (@mc_raz)


    I’m using the restrict content plugin which works really well but the sidebar still shows the normal content to users that are not logged in.

    Currently my single.php grabs my “main” sidebar with…

    <?php get_sidebar('main'); ?>

    I was hoping to add a conditional tag that grabs the “default” sidebar if a user is not logged in.

    Thanks in advance to anyone offering help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Try is_user_logged_in()

    <?php if ( is_user_logged_in() ) get_sidebar('main'); ?>

    If this is the solution please mark the post resolved.

    HTH

    David

    a conditional tag that grabs the “default” sidebar if a user is not logged in.

    extended from David’s reply:

    <?php if ( is_user_logged_in() ) { get_sidebar('main'); }
    else { get_sidebar(); } ?>

    Hi alchymyth,
    I missed that bit!

    David!

    Thread Starter mc_raz

    (@mc_raz)

    Thanks guys, I am only reasonably new to this stuff. I am at the point where I am starting to understand what needs to be done but implimenting it still confuses me at times. Your suggestions worked perfectly and I was then able to use it to fix another problem that I discovered too.

    Thanks again for your help!

    Thanks for helping out, David! mc_raz, I hope you continue to enjoy the plugin ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘hide sidebar from users that arent logged in’ is closed to new replies.