Homepage other than Activity or Admin Blog (or a WP page)
-
This may be one of those things where the answer is obvious and my brain is locking up again, but I’ve been trying to figure out how to have the default front page (set in the Dashboard under Settings–>Reading) to be other than
a) The Activity Stream
b) The Admin Blog
c) A WordPress Page
In other words, I’d like to have visitors land on, say, the Buddypress Groups page or the Forums page or the Blogs page.
Altering the order of the nav items in header.php in my child theme makes one of those appear first in the navigation tabs list, of course, but people landing on the site still see the Activity stream first (which is how I have it set in Settings–>Reading).
Thanks!
-
@jivany – yup
@Modemlooper – as stwc posted above, he wanted a front page other than c) A WordPress Page
Should one want to continue in that vein (via Settings > Reading > static home page), instead of creating the special template file home.php, he can:
1. Create a Page template, e.g. page-home.php and paste 2.a. or 2.b. within and upload to server.
2. Create a page called Home using the page template and publish.
3. Go to Settings > Reading > Static home page and choose Home.
4. Delete the link (forums or blogs or groups) from header.php navigation div to avoid duplication
Just woke up — I’m in Asia — and I’ll try this later today. Thanks again.
@Modemlooper – as stwc posted above, he wanted a front page other than c) A WordPress Page
Actually, not really — I just want to show one of the other default BP site sections — forums or blogs or members. But if this is a general solution that also includes that ability to do that, even better.
Success! Thank you, everyone!
Here’s what I did, following mercime’s advice.
1. Created a new page template page-home-tempate.php in the root of my child theme, with content
<?php
/*
Template Name: Home Page
*/
?>
<?php locate_template( array( 'forums/index.php' ), true ); ?>2. Created a new page in WPMU, called it ‘Home’, using that new page template.
3. Set that as my front page in Settings–>Reading
4. Deleted the Forums navigation item from header.php in my childtheme
5. YAY!
Now my next task is to figure out how to let my users set a user preference to see that page (Forums, in my case) as their front page, or Activity.
But that’s a thread for another day!
Create a different child theme, each theme with a different front page, then allow users to switch themes.
That’s a good idea. I wonder if it’s overkill, though.
Now to find a theme switcher plugin that remembers people’s choices and give that a try!
Only downside I’ve noticed so far is that etiviti’s Forums Index extra fails now (silently).
Gonna ask him if he knows why… can’t find it, myself.
Shouldn’t be too difficult to hook into the user’s BP settings tab and have a drop down box that allows them to select the various components as the front page. Have the drop down box save the component slug (so ‘forums’ for the Forums, ‘activity’ for the Activity stream, etc) and then you should be able to just use that slug in the locate_template call in your new page template that you created.
Something like:
<?php locate_template( array( $user_selected_component.'/index.php' ), true ); ?>
Only other weird side effect I’m seeing (and failing to track down, as usual), is that posting from the new Forum site front page (the Ajax-appearing form) fails without any error messages.
Posting from site.com/forums/ still works fine with the same form, though. Hmmph.
@stwc – might be a bug somewhere. Instead of using
<?php locate_template( array( 'forums/index.php' ), true ); ?>
try copy and paste code directly to your Home Page Template https://trac.buddypress.org/browser/tags/1.2.3/bp-themes/bp-default/forums/index.phpI’ll try that, mercime, using the code from the forums index page in my child theme. Means making sure that the code is the same for both ‘versions’, but that’s OK with me, if it works.
I actually got wp_redirect working too, but it’s a bit slower than I’d like, so this would be better.
Maybe I’m misunderstanding the directions here.
MY objective is to show a different homepage for UNREGISTERED users.
I tried the examples above and I can get a different home page to show or basically overwrite the default settings. But I can’t seem to set a different home page if the user is NOT logged in.
Example: I create a page called “NEW HOME PAGE” this will be shown to UNREGISTERED users who have NOT created an account. Meaning they are NOT logged in. I would like the “NEW HOME PAGE” to be shown to them.
When the user logs in, they will see let’s say the Activity Stream upon log in.
Any ideas on this?
Thank you.
Maybe I’m misunderstanding the directions here.
MY objective is to show a different homepage for UNREGISTERED users.
I tried the examples above and I can get a different home page to show or basically overwrite the default settings. But I can’t seem to set a different home page if the user is NOT logged in.
Example: I create a page called “NEW HOME PAGE” this will be shown to UNREGISTERED users who have NOT created an account. Meaning they are NOT logged in. I would like the “NEW HOME PAGE” to be shown to them.
When the user logs in, they will see let’s say the Activity Stream upon log in.
Any ideas on this?
Thank you.
You have to wrap what you want to show in a function.
They both have to be in the SAME PAGE.
<?php
if ( is_user_logged_in() ) {
echo 'Welcome, registered user!';
} else {
echo 'Welcome, visitor!';
};
?>Don;t paste this code directly in a post. you’ll have to put it in a page template.
You have to wrap what you want to show in a function.
They both have to be in the SAME PAGE.
<?php
if ( is_user_logged_in() ) {
echo 'Welcome, registered user!';
} else {
echo 'Welcome, visitor!';
};
?>Don;t paste this code directly in a post. you’ll have to put it in a page template.
Andrea_r,
Thanks that’s very clear.
Ok, seeing as what I want to do is in the same area as this thread, I suppose it might aswell be posted here rather than a new thread.
I wish to achieve 2 things:
Unregistered/logged out users should see the activity stream, BUT, with blog posts only
Registered and logged in users should have http://xxxxx.xxx/members/xxxxx/activity/friends/ as home page, rather like the home page on facebook, so when you log in, or click “home” in navigation, you should end up there.
Anyone have advice on how to achieve this?
I tried this method with Buddypress links, I want to make them my front page.
I got the links to show up on a custom page but the formatting is all screwed up and the share button seems to be broken. I think it is not loading the css file for the links or the added javascripts. How would I go about updating it so that it works properly?
This is what my custom template page looked like. I had to copy over the bp-links-default directory over to my-buddypress theme.
`
`Here is the actual page http://www.playbookit.com/frontpage
Anyone know how to fix this? I’ve been at it for a few days.
- The topic ‘Homepage other than Activity or Admin Blog (or a WP page)’ is closed to new replies.