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 10 replies - 51 through 60 (of 60 total)

  • pressography
    Participant

    @pressography

    Perhaps I’m missing something here. You can’t use a home.php theme page for your home page (like most WP magazine-style themes do, so theme users don’t have to manually edit anything to make them look right), and also use /blog for the main blog page? That’s the way BP used to work automatically, what changed?

    It seems silly to force a user to create 2 blank pages and 2 theme files to get the functionality that was there in the previous versions… It worked just fine before, why change it?


    pressography
    Participant

    @pressography

    I found the function that was creating the /blog behavior from before, added it to my theme functions.php file, and it’s working fine again. No pages, no Settings > Reading changes, nothing.

    Here’s the function: (Note – I changed the function name in my code just in case there were any conflicts. I’m pasting the original code here, so be aware)

    /* Make sure the blog index page shows under /[HOME_BLOG_SLUG] if enabled */

    function bp_dtheme_show_home_blog() {

    global $bp, $query_string, $paged;

    if ( $bp->current_component == BP_HOME_BLOG_SLUG && ( !$bp->current_action || ‘page’ == $bp->current_action ) ) {

    unset( $query_string );

    if ( ( ‘page’ == $bp->current_action && $bp->action_variables[0] ) && false === strpos( $query_string, ‘paged’ ) ) {

    $query_string .= ‘&paged=’ . $bp->action_variables[0];

    $paged = $bp->action_variables[0];

    }

    query_posts($query_string);

    bp_core_load_template( ‘index’, true );

    }

    }

    add_action( ‘wp’, ‘bp_dtheme_show_home_blog’, 2 );


    AndreMartin
    Participant

    @andremartin

    Awesome, thanks!

    Adding that function was the solution. Now it all works again as supposed to, being able to choose what to show on the frontpage:

    – Activity stream

    – Page

    – Post

    @pressography and @andremartin: Is that working for you to call directly the BP_HOME_BLOG_SLUG in your navigation for instance:

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

    As that isn’t for me, yes I can have the home page and a switch to choose what you show on the front page but I can’t call it directly in the old manner or even with a direct blog/ by using defines in the function. There is no define in the core for BP_HOME_BLOG_SLUG anymore so that was my thinking to define it. I’m trying to get just like before a direct call to the main blog under the navigation if that isn’t the front page for reference of what I’m trying. I’m also trying to not have too much nasty code in functions.php so if you got it working this would be far more preferable.

    I just get it linking or trying to link to a page and coming up with page not found even with a define and opting with a blog/ call – this is on the full release version of 1.2.


    pressography
    Participant

    @pressography

    I forgot that I added a custom BP_HOME_BLOG_SLUG, so I never noticed that it was missing from the core. Whoops! Yeah, you’ll have to define it yourself, but after that, this should work.

    Yeah sadly even with a define that is causing it to look for a page called blog/ if you put the define in functions.php. I’m attempting to do this without having a custom wp_conf or anything in plugins – so basically the hard way it seems.


    pressography
    Participant

    @pressography

    Try defining the home slug in a file called bp-custom.php and put that file in the plugins folder. That’s how mine is set up.

    functions.php is too late – BP is already loaded at that point


    @mercime
    Keymaster

    @mercime

    I’ve had a home.php and a blog page working in custom child themes of bp-default since 1.2 trunk and in bp-sn-parent before that, I did it this way:

    1. create home.php as usual

    2. create header-home.php to protect home.php

    – made it when in 1.2trunk a conditional statement inserted in header.php limited home page to blog page or activities page and kicked out my home.php :-)

    – in home.php call header-home.php with

    <?php get_header('home'); ?>

    3. create “blog page” with pagination

    – 2nd option in this post http://www.nathanrice.net/blog/creating-a-blog-page-with-paging/

    – Make sure you delete spaces between <?php after copying codes from that post

    Except for the hiccup in #2 above, home.php, a WordPress template file has been respected in BuddyPress custom child themes and it overrode any home.php file in parent theme.

    Cheers.


    kasper777ny
    Member

    @kasper777ny

    Just a question. I set up my home page to be a static page and my blog to be a static page by doing the following:
    Setings | Reading | selecting “A Static Page” and setting Front page to my static page, and setting “Posts Page” to a static page.

    That part all seems to work: If i click on either of the two static pages it does what its suppossed to do… however, if i click on the “blogs” tab and search for my sites MAIN blog, and click on it, It still goes back to the HoME page (and therefore will not show the blog).

    Is there something i can do to fix this?


    Dia Ritoch
    Participant

    @dritoch

    I got this solution from Mr. Brajesh Singh:

    This is a problem with Buddypress 1.2
    There are a few ways to fix this though.
    In your bp-custom.php, put these lines, and it should work.

    define(“BP_HOME_BLOG_SLUG”,”blog”);
    function bpdev_blogs_setup_root_component() {
    /* Register ‘blog’ as a root component */
    bp_core_add_root_component( BP_HOME_BLOG_SLUG );
    }
    add_action( ‘bp_setup_root_components’, ‘bpdev_blogs_setup_root_component’ );

    And to some who may not know where to put the bp-custom.php, bp-custom.php should be created in wp-content/plugins NOT in wp-content/plugins/buddypress.

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