adding content to the 1.2 default theme homepage
-
Does anyone have any thoughts on how to add content above the activity stream on new default homepage? I love the template, and plan on building out a child theme to change certain aspects of it, but absolutely can’t figure out why HTML being added to home.php doesn’t change anything.
It seems like functions.php is forcing the activity stream into place, which is fine, but placing HTML into home.php renders it either above the header or below the footer, depending on where you place it. So far I’ve found it impossible to add something as simple as a welcome paragraph above the activity stream. Once it’s set in the theme options, you’re stuck.
Any thoughts on this? The old default is widgetized, which was nice. Is there a way to eliminate just that functionality from the theme, code in the activity stream in home.php without using functions.php to set it? I could wrap whatever I wanted then, or even put the activity stream in a widget if I wanted.
edit: to clarify, this is within the “content” div.
-
Just to add more detail: this is what renders the activity stream on the homepage. Commenting out the small amount of code in home.php doesn’t seem to do anything. Commenting this out in functions.php seems to break things.
Is there a way to either eliminate the option to set what appears on your homepage, thus giving you complete control over what appears there (and maybe building/adding a special “Activity” page to replace it), or to amend this function in some way that let’s you call modify how it renders?
function bp_dtheme_show_on_frontpage() {
$settings = get_option( 'bp_dtheme_options' );
if ( empty( $settings['show_on_frontpage'] ) || 'blog' == $settings['show_on_frontpage'] )
return 'blog';
return 'activity';
}I completely understand the easy-to-use, out-of-the-box logic behind the setting for what appears on your homepage, and it’s certainly Facebook-like, but I’m using the default template to build out a full site that needs to have a unique hompeage with other content elements. The activity stream is a small part of it, and I’d like to have it there in some way, but certainly not as prominent as it is now.
This is the code that’s in home.php (all of it):
<?php
/***
* Should we show the blog on the front page, or the activity stream?
* This is set in wp-admin > Appearance > Theme Options
*/
if ( 'blog' == bp_dtheme_show_on_frontpage() )
locate_template( array( 'index.php' ), true );
else
locate_template( array( 'activity/index.php' ), true );
?>The comment obviously notes the intention of activity stream OR blog, but what about ‘neither’? I’m going to work on this later, but one idea I have is to try to add a third option of “custom”, which would pull something like “custom.php”. Sound right? Something else?
Thanks in advance!
Sorry I just keep replying to myself. After I typed it out, I saw what I had been missing for the hours that I looked at it. Adding my solution for others who may be trying to do something similar.
I’ll probably clean up how this is implemented later, but in home.php, edit ‘index.php’ to read something like ‘custom.php’. Then, create custom.php with whatever HTML you want, then upload it to your sever. You can include the template the same way as always, by calling the header/footer and using the proper divs. Then, in settings, select “Blog Posts” to display on the home page. Now your homepage should render using whatever code you dumped into custom.php.
I’ve been trying to sort out the same issue myself, I will be interested to see what you do.
I’m working on the child theme as well and I was really “impressed” with that code in home.php ))
I agree with you that for the actual site there is too small option to have only activity stream or blog bosts on the homepage… so I put my own home.php that has all my staff in the child-theme directory and it overrides completely the home page behaviour…
That probably is not the perfect solution, but probably it will work for you
@foralien – You are not alone While there is a cool option to change what appears in home page – blog or activities – in 1.2 bp-default, when install is used as CMS neither of those will suffice. I used the same solution – custom home.php in child theme of bp-default. Primary navigation is for site content and BP components are in secondary navigation. Just have to double-check any relevant changes in parent theme’s header.php code whenever I upgrade.
Cheers.
InactiveMaybe you take a look into /activity/index.php or header.php!
I changed in these files a couple things for my homepage.
Simliar what you probably want to do
you can see it here > http://www.mymape.com
Choose blog page in BP settings then in the admin sidebar settings >> reading choose a static front page then you can do page templates to anything you want.
I think the BP setting should allow to choose static pages for the front as well as blog or activities.
@mercime (and everyone else), could you explain in detail how you got the home.php to work with your child theme? I’ve created a home.php in my child theme, but it seems to keep defaulting to the index.php.
I’ll do some work on this to better support a custom page as the home page.
@Andy cant you just add the option to choose a static page on the page you have set up too choose blog or activity?
Don’t I get this, but it is already possible through the normal WP-Options, isn’t it? I can make any static page the homepage…
yeah but in BP you can choose blog or activity. If you choose blog then you can go into reading and change the blog front page to a static page. It would be easier and more user friendly to have the static page option in the BP settings.
@tmort – as AndyP. will be setting up a better way to make it easier to have a custom home page, you won’t have to go thru my gnarly functions and processes to ensure my custom home.php worked with 1.2 bp-default. It’s great to have these issues being resolved as BP 1.2 is enroute to stable version release. Thank you Andy P.
This is fixed in trunk. Now you can just select “Activity Stream” as a page that you can use for the front page in “Settings > Reading”. This will also let you choose a static page instead, or a page to show posts on.
You also need at least one page to see this option. So you might want to create a page to show blog posts on such as “News”. Then select the appropriate options in “Settings > Reading”.
Thank you Andy. Just downloaded BuddyPress from trunk-r2614 to test and saw that only the bp-default theme is in bp-themes folder. Is bp-sn-parent and bp-classic being phased out?
I read a commit comment in trac that the classic theme was moved to the backwards compatibility plugin.
Thank you David. I will just adjust my child themes based on bp-sn-parent accordingly. Cheers.
There will be no classic theme in 1.2 final. Anyone who downloads the backwards compatibility plugin will be able to use it though.
Thanks Andy! It’s much easier to include different front page layouts via page templates when constructing themes. Like the classic themes widgetized homepage.
I had a similar dilemma but managed to figure it out, even how to add javascript without screwing up the activity stream (see https://buddypress.org/forums/topic/add-content-above-activity-stream-in-bp12 ).
Assuming you’ve elected to have site activity shown on your home page, you want to add content to bp-default>activity>index.php. Not home.php. The neat thing is that you can add content that displays to non-logged-in users that is different than that displayed to logged-in users.
You can see it in action on my site here: http://rspace.org
How come http://www.mysite.com/blog/ doesn’t work anymore? (404). It used to use my index.php template while home.php was my homepage. ARGH!!!!!!!!!!!!!!!!
Sorry. I’m frustrated beyond belief at the moment. Deadline tomorrow. Broken site.
Question
Does the change mentioned in this thread remove support from the WordPress template hierarchy for using BOTH a home.php (standard template that’s part of the WordPress hierarchy) and an index.php file? Because I require both.
it still supports home and index? i think andy was just referring to the new option to set an alternative home page under admin>reading… what are you trying to do exactly?
perhaps i can help. home will always override index. the ‘blog’ slug was used in mu as the default slug for the home blog if you need to use the index.php from bp default under the slug ‘blog’, or any other url for that matter you could just add your custom slugs in the config file.
Hey Windhamdavid,
Thanks so much. Sorry for the frustration. I posted that after 2.5 hours of porting hell. Turns out my server is running PHP 5.2.x and I developed locally in 5.3… and I had a function that 5.2 did not support. 2 hours in SSH trying to update PHP before giving in and contacting tech support. Argh! THEN… I found out my /blog/ link stopped working. Double argh!! LOL :o)
Anyway… my theme uses home.php for the homepage and index.php for /blog/. It worked great until the latest trunk.
So perhaps this can be fixed using a custom slug? That would be fantastic. Thanks so much!!! I’ll look into that. Never added a custom slug before.
The situation is that I need a homepage loop (home.php) that only shows a subset of posts as well as a full loop with a paginated result set of ALL posts… what would normally be your homepage (index.php… aka /blog/).
To explain… it’s a magazine site. All posts belong to an “issue” and will be tagged as such using a custom taxonomy that I registered in functions.php. So my homepage loop uses a custom query to output only the posts from the most recently added issue.
So that’s the homepage. Then there’s an “Archived Articles” link at the bottom of the page that uses index.php with the standard paginated homepage loop so that you can step back in time. It’s just a link to /blog/.
Anyway… I’ll look into that config file solution!!! Thanks!!!
- The topic ‘adding content to the 1.2 default theme homepage’ is closed to new replies.