WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
determining if the user is logged in

Please check my site http://247ebookstore.com/sg3/monestatic-igues/ still working on it. If you check the given page you'll see "Visit Website" button there. I want that User must Logged In to view the website link. I don't know much coding so please anyone kindly tell me the code and place where to put it. Thanks.

share|improve this question

marked as duplicate by Chip Bennett, kaiser, toscho Nov 30 '12 at 21:09

This question was marked as an exact duplicate of an existing question.

Did you try searching the site for related answers before posting? – Chip Bennett Nov 30 '12 at 20:41

You could give Private Only a shot - but it's best for you to do your own research on the Plugin Repository to find the plugin that suites your needs best.

share|improve this answer

You can wrap any content with:

<?php if( is_user_logged_in() ): ?>

Only for logged in users

<?php else: ?>

You need to login

<?php endif; ?>
share|improve this answer
I couldn't find that code. Could you please help me? Any logged in user can submit the listing so I don't know how this theme working in creating listing. Where to put this code? – user24272 Nov 30 '12 at 20:52
You need to add that code to the template that is creating the "View Website button". Wrap the if( is_user_logged_in() ) code around that button. – developdaly Nov 30 '12 at 20:53
Thanks developdaly, You made my day. I found the place its "_single.php" I've edited it and wrapped the codes as you instructed and it worked! 247ebookstore.com/sg5/directorypress – user24272 Dec 2 '12 at 12:51
Now what I want is, if user is paid member(Gold Member on my site) and if user has visited the site in 24 hours and if the sweepstakes is of category "one entry/day" then it shows "You have already entered for today" and if it is one time entry then it shows "Already Entered" so my Gold members don't get disqualified and this would be the main feature for members. If you can tell me code then I would be thankful. – user24272 Dec 2 '12 at 12:57
You should accept this answer as complete and open a new question ... this one was closed, so you'll get better responses with a new Q. – developdaly Dec 2 '12 at 16:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.