- This topic has 1 reply, 2 voices, and was last updated 13 years, 3 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
Support site for Tips and Tricks HQ premium products
by
Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember General Questions › Exclude sidebar widgets from non-logged in visitors
I am looking for a solution for the possible exclusion of sidebar widgets for non-logged in visitors. I had a search and was pointed to this thread here https://support.tipsandtricks-hq.com/forums/topic/adsense ,which does work fine, only that I need it the other way round:
display a sidebar widget (menu navigation) only for logged in members, but not for other visitors.
The code above makes the menue-widget visible to nonlogged in visitors, but it is then invisible for logged in members.
How do I need to alter this code in order to get the function “turned” the opposite?
Here is the php code I would like to alter:
<?php if (!wp_emember_is_member_logged_in()){?>
/* “Widget code goes here. It is now only visible to non logged-in visitors. But I would like to have it displayed only for logged-in members, not for visitors.” */
<?php } ?>
I am not familiar at all with php, so I would like to ask for help with this, please.
Cheers,
Ellen
Simply use the following:
<?php if (wp_emember_is_member_logged_in()){?>
/* "Widget code goes here. It is now only visible to logged-in visitors." */
<?php } ?>