I'm creating a Social Network using BuddyPress, a good theme for BuddyPress itself and some plugins included with the theme that help me so much in this thing.

I'm trying to do one thing: when the user goes to website.com, he'll se the website informations, so like "subscribe, this is a good place" etc. But when the user is logged in, I would that in the homepage should appear, instead of the classic homepage, the BuddyPress activity!

How could this be possible? Can I do that?

Is like the thing that does Facebook and so many websites: if your not logged in, you can register and login, if you are logged in, you can see your Facebook home: everything ever in facebook.com

And I want to do the same on my website!

Thanks to everyone for any help!

  • In a nutshell: Make use of a custom front page template - front-page.php - and is_user_logged_in() to show different content. Oct 6, 2015 at 16:30
  • Thank you for the answer. Is there any way to do something like this with Visual Composer? It was shipped with my theme.
    – Optiroot
    Oct 6, 2015 at 16:50
  • Sorry, but I don't know anything about visual composer. Oct 6, 2015 at 16:55

1 Answer 1


I just wrote some code to do something a bit different, but it should work for what you're trying to do. It's hooked in at the wp hook, which will prevent redirect loop errors. This will go in either a functions.php file or your own custom plugin (recommended).


    function restrictEnterSite(){
    // Make a template of the splash page you'd like to display if user is not logged in
    $homeURL = home_url('/splash-template.php');

    if ( $homeURL !== $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] && !is_user_logged_in() ) {



Give this a shot!

  • Thank you! This is really great! I tried it, and I saw that it could be possible, and it's good. But I see that is not so much 'fast' as project! What I mean is: I need to finish the job in some hours or so; then I thought to use Visual Composer to finish things quicker! And the other problem is that I don't know how could I implement the BuddyPress Activity in this way... Because the page should be set via BuddyPress settings... So it's hard now... I was thinking to have the homepage as normal, and the page /activity; if the user is logged in, when he goes to the homepage he gets [...]
    – Optiroot
    Oct 6, 2015 at 18:45
  • [...] redirected to /activity; if the user is not logged in, he'll remain in homepage! What do you think? How could I achieve this? Anyway thank you really so much for your code, I'll keep it safe, dehe.
    – Optiroot
    Oct 6, 2015 at 18:46
  • Ok, this is a quick and dirty approach. Take the code I gave you up there, and make it point to that template. Take a test page somewhere, and make the page how you want it to look. Then take that shortcode, and put it into here: add_action('genesis_entry_content','myShortCode') function myShortCode() { echo do_shortcode('YOUR SHORTCODE HERE'); } Then put all that into your template page. It's not best practice, but its fast.
    – CA_
    Oct 7, 2015 at 19:12
  • Thank you anyway! I tried and it worked! I close the question. But now I have a problem with 404's redirects... I open a new question. Thank you so much.
    – Optiroot
    Oct 11, 2015 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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