Skip to:
Content
Pages
Categories
Search
Top
Bottom

adding content to the 1.2 default theme homepage


  • lautering
    Participant

    @lautering

    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.

Viewing 25 replies - 26 through 50 (of 60 total)
  • I tried adding define( "BP_HOME_BLOG_SLUG", 'blog' ); to my wp-config file and when I visit /blog/ in my browser I still get a “Page Not Found” and the index.php template is not being used. I’m at a loss. I have my reading settings set to “Your latest posts”.

    Up until the most recent trunk, the homepage of my site used home.php (with my custom query) and /blog/ used index.php (with the standard loop).

    I just tried changing BP_HOME_BLOG_SLUG to something other than the default (duh) and not only does mydomain.com/bloggyblog/ not work, but when I view a post the url is still mydomain.com/blog/2010/02/04/hello-world/ as opposed to mydomain.com/bloggyblog/2010/02/04/hello-world/ However, when I did a test and changed a different slug, that worked. I was able to change “activity” to “stream” for instance. Perhaps it’s a bug?


    Windhamdavid
    Participant

    @windhamdavid

    sounds like fun.. Oh, I know the feeling, why do you think I’m up late working? add the ‘blog’ page using the admin, make sure the page slug is blog and then set your ‘blog’ slug in the config and It won’t 404 on you.

    Yah… SSH command line stuff is a dream. LOL. Especially for someone who is a designer first and a coder second :o)

    So you mean create a WordPress “Page” called blog (and make sure it’s slug is ‘blog’)? I had tried using my index.php file as a template that I assigned to a page… but the loop didn’t work.

    It is weird tho’. In pervious versions of BuddyPress… you could go to /blog/

    Ya that doesn’t work. I get a “bloggyblog” page of course… but it’s just a page using single.php. And if I assign index.php to it as a custom template the loop doesn’t work. Which I don’t quite understand. It’s the standard WordPress loop.


    Mike Pratt
    Participant

    @mikepratt

    @David From my experience on my site, you don’t even need to define the blog slug, just set the posts page under Settings>Reading after you create the Blog Page.

    @Andy – Suggest a note to folks to take these steps as it won’t be apparent/intuitive to everyone


    MrMaz
    Participant

    @mrmaz

    Hrmm. I miss the “Blog” tab when the home page is set to “Activity” as well.


    MrMaz
    Participant

    @mrmaz

    @David Lewis

    1. Create a page called Blog, make sure the slug is ‘blog’

    2. Go to Settings > Reading and set the “Posts page” to Blog

    I just tried this and it works, although the tab is all the way to the right.


    Anna Ladoshkina
    Participant

    @foralien

    @David Lewis

    I’ve me the similar problem when WP+BP instaltion is not in the root folder of the server.. but in folder called “blog” :)

    And only changing the home blog slug make things work… I’ve not actually found what exactly caused that.. probably something in the url rewriting mechanism – so this is just the note ^)

    @Everyone: Thank you so much for the replies but I’m not sure the issue is being understood. The issue is the template hierarchy not working as it should. Without changing anything in your reading settings home.php should be used for the homepage and index.php should be used for the /blog/ slug. That no longer works.

    @Mike: I was trying to change the slug since /blog/ no longer works. It worked before. / used home.php and /blog/ used index.php and both had functioning loops that returned posts.

    @MrMaz: That works to change the homepage but the template hierarchy seems broken (see above). I can set up the homepage to manually use a page with home.php assigned as it’s template and then I can actually link to /blog/ and it WILL use index.php (yay)… but the only posts the loop returns i.e… if ( have_posts() ) : while ( have_posts() ) : the_post(); is the page you’re on since (I’m guessing) /blog/ is not longer considered a home page.

    Perhaps I need to have TWO custom queries? That may be the solution. Use my custom query for the homepage (however that is set and using either home.php or index.php… all irrelevant)… and then a custom template assigned to whatever page I want (maybe a page called Archives) that uses a custom query to return all posts from the database (i.e. so the loop results won’t be based on the slug… but on your custom query). Seems like a few hoops to go though. Worked fine before simply by using the WordPress template heirarchy and / and /blog/. As long as I can get it working though… it’s all good.

    @foralien: It’s a root install.


    MrMaz
    Participant

    @mrmaz

    @David Lewis

    Not sure if you are aware that home.php was completely removed from the default theme in trunk? You may know this already, but just wanted to make sure.

    If you still have a home.php in you child theme, I am not sure that BuddyPress is even looking for it.

    Just throwing some stuff out there in case it helps break anything loose.


    Mike Pratt
    Participant

    @mikepratt

    @David I just created a page called ‘blog’ (which defaults to ‘blog’ for that page’s slug

    The following menu item in header.php:

    <li<?php if ( bp_is_page( BP_HOME_BLOG_SLUG ) || bp_is_blog_page() &&
    !is_front_page() && !is_page() )
    : ?> class="selected"<?php endif; ?>>
    <a>/<?php echo BP_HOME_BLOG_SLUG ?>/" title="<?php _e( 'Blog', 'buddypress' ) ?>">
    <?php _e( 'Blog', 'buddypress' ) ?></a>

    renders a menu item domain.com/blog, just like it used to.

    You need to make sure you choose that page in Settings>Reading ‘Posts page’

    On further reading of your post, maybe I don’t understand. I just know, what I described produces the exact same results as prior to the change (and removal of home.php)

    @MrMaz: BuddyPress does use home.php if it exists in your child theme. It just can’t seem to use BOTH index.php (for /blog/) and home.php (for /). It used to be able to use both.

    @Mike: Thanks. All that does however is create a link to /blog/. What I needed was for /blog/ to use index.php.

    In the meantime I’ve actually solved this quite simply. Forget all the homepage settings stuff. All I did was create a page called “Blog” and assigned a custom template to that page. In that template, instead of using the normal index.php loop… i.e.:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    which would return posts based on the slug (so it only returns the page that you’re on if you’re on a regular “Page”)… I used this (to return all posts in the DB):

    <?php $postslist = get_posts('order=DESC');
    foreach ($postslist as $post) :
    setup_postdata($post); ?>

    <!-- Posts Loop Here -->

    <?php endforeach; ?>

    Actually… I take that back. My solution above does not work because the posts will not be paginated. I also tried this within my “Archives” custom template:

    <?php query_posts('posts_per_page=5'); ?>
    <?php if ( have_posts() ) : ?>
    <?php next_posts_link() ?>
    <?php previous_posts_link() ?>
    <?php while ( have_posts() ) : the_post(); ?>

    <!-- Posts Loop Here -->

    <?php endwhile; ?>
    <?php endif; ?>

    Same problem. Posts don’t paginate. Maybe because they are on a regular page instead of the homepage. This just worked before. I could go to / (home.php) and /blog/ (index.php). Argh.


    Andy Peatling
    Keymaster

    @apeatling

    I can’t follow this thread, can you post exactly what you are trying to do in a single sentence?

    @Andy: In previous trunk versions I was able to use both a home.php template (/) and an index.php template (/blog/) but now I get a 404 when I go to /blog/.

    Explanation: My theme is set up so home.php uses a custom query to show all posts tagged with the most recently added tag in a custom taxonomy (i.e. taxonomy “issues”, tag “Winter 2010 Issue”) while index.php is a normal WordPress homepage loop returning a paginated result set of all posts by date. This doesn’t work anymore since /blog/ (index.php) returns a 404.


    Andy Peatling
    Keymaster

    @apeatling

    Copy your index.php contents into a new template called blog.php.

    Add this to the very top:

    <?php /* Template Name: Blog Home */ ?>

    Then create a new page called “Blog” in your wp-admin area. On the right menu of the page creation screen you’ll see a dropdown called “Template”, select “Blog Home” and save the page.

    Go to “Settings > Reading” and check the “A static page (select below)” and select nothing for the first dropdown and “Blog” for the second dropdown. Save.

    Followed the above to the letter. That makes /blog/ work of course but the page does not use the assigned custom template (blog.php). It uses index.php or home.php.

    Just to make sure I’m being clear… I’m not trying to make domain.com/blog/ my homepage. I’m trying to make domain.com my homepage and domain.com/blog/ another page which shows a paginated result of all posts.

    Greatly appreciate all the help so far. Hoping I can get this working one way or another.


    Windhamdavid
    Participant

    @windhamdavid

    endless thread :) ~ do exactly what andy said and you’ll have a page domain.com/blog that shows a paginated result of all posts.

    I did do exactly what Andy said and both domain.com and domain.com/blog end up using home.php. Still looking for a solution I’m afraid.

    Andy’s instructions didn’t work because I still had a template named home.php for my homepage and it was taking over control of my posts page even when I had manually assigned it to my custom “Blog” page and template.

    If anyone cares (LOL)… here’s the solution to having a separate front page and posts page that can both use a full paginated result set from the database.

    1. Make a template for your homepage with a filename OTHER than “home.php” or “index.php”. I used “homepage.php”.

    2. At the top of this file add <?php /* Template Name: Home */ ?>

    3. Make a WordPress Page called “Home” and assign it to the template you just made (i.e. “Home”).

    4. Make a WordPress Page called “Blog” and leave it assigned to the default template (which will be index.php).

    5. In the Reading Settings switch to static mode and set the Front Page to “Home” and the Posts Page to “Blog”.

    Thanks for the help guys. That was a mind bender. Just seemed easier (from a development point of view) when home.php and index.php defaulted to “/” and “/blog/”

    Now I think I need a drink. LOL :o)


    Bowe
    Participant

    @bowromir

    I have this topic bookmarked and make sure to add it on the new BP-Tricks.com.. this seems like a mindbender indeed.. Thanks for figuring it out though ;)


    Andy Peatling
    Keymaster

    @apeatling

    To be honest the way it is now is the way every WordPress theme designer is used to. It’s the way WordPress does it natively. Using home.php is actually not the best idea since it overrides all settings – as we found out in the end.

    @Andy. Yup. It makes sense to me now that I’ve figured it out. After your instructions didn’t work as expected, I went back to basics and read the codex page about “Reading Settings” and under the “Front Page” bullet near the bottom of the page it says “If you would like to create a static home page template file, do not name it home.php”. Ding ding ding! Light bulb. So I put two and two together and finally figured it out.

    https://codex.wordpress.org/Settings_Reading_SubPanel

    Glad I’m not crazy after all. Sorry. I know my additions to this post were very confusing and probably a little frustrating. And thanks again Andy! Although your instructions didn’t work quite as expected because I had that home.php file, at least I knew I was on the right track! You’re a lifesaver.

Viewing 25 replies - 26 through 50 (of 60 total)
  • The topic ‘adding content to the 1.2 default theme homepage’ is closed to new replies.
Skip to toolbar