Skip to:
Content
Pages
Categories
Search
Top
Bottom

Comments won't display on main blog

  • I am running WPMU version 2.7.1. It is a brand new install, and all I have done to it is modify the theme to change the header and footer.

    I have run into an issue where comments will not display on the main blog. I think I’ve found the source of the problem, but I don’t know how to resolve it. On the regular blogs when you view an individual article it uses the single.php file from the theme. On the main blog however it is using the index.php page which doesn’t have any code to show comments. What is causing this and how do I fix it?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    This doesn’t sound like a BuddyPress issue.

    It’s a WPMU issue; to be more specific, it’s a theme issue.

    Do you want to show a link to comments or do you want to show actual comments?

    There are number of ways to do this… theme hacking or adding a widget which displays the latest comments.

    Adding a widget would be the simplest, but it depends on what you want to do.

    I guess my main question here is why does the main blog use the index.php part of the theme to display a single article, when all the other blogs using the same theme use single.php?

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    twdsje, by the sound of it, I’m guessing you’re using the default WordPress MU home theme.

    You can choose a different theme you know!

    Do you even have BuddyPress installed?

    If you do, select the BuddyPress home theme or some other WordPress theme in the WPMU admin area and you’ll see something entirely different.

    That’s the beauty of themes!

    I am actually using a custom theme I made myself by modifying the buddypress home theme. It is the only theme available on the website. I’ve disabled all others.

    Here is the link to the website. http://entreprenuerinmaking.com

    You will notice that viewing articles at http://entreprenuerinmaking.com/blog you do not see the comments section, but if you go to http://entreprenuerinmaking.com/twd the comments section is visible.

    Placing echo statements in the theme files further shows that the /blog site is using index.php to serve a single article, while the /twd site is using single.php to serve a single article. They should both use the single.php file. In order to resolve my issue I have to figure out why.

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    I can’t access your site at the moment because the DNS isn’t resolving to your website.

    Sounds like it could be a BP issue after all, but a lot of other BP sites have comments working fine:

    eg. http://simplercomputing.net/bp/blog/buddypress-chat-plugin/

    Silly question, do you have comments enabled on the main blog?

    Sorry I typed in the URL wrong:

    http://entrepreneurinmaking.com

    I do have comments enabled. In fact there are actually comments on most of the articles as they were imported from another wordpress blog.

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    Okay I think I can safely say it’s a BP theme issue.

    You need to make sure your code is exactly the same as the default wp-content/themes/bphome/comments.php (or wp-content/plugins/buddypress/bp-themes/bphome/comments.php)

    Try that.

    They are the same. Thing is on the main blog it’s never even getting to the comments.php page since it’s calling index.php instead of single.php like it should.

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    I think I’ve got it.

    Do you have the same functions.php in your “buddypress-home” theme?

    This is the code that does the magic:

    function bp_show_home_blog() {
    global $bp, $query_string;

    if ( $bp->current_component == BP_HOME_BLOG_SLUG ) {
    $pos = strpos( $query_string, 'pagename=' . BP_HOME_BLOG_SLUG );

    if ( $pos !== false )
    $query_string = preg_replace( '/pagename=' . BP_HOME_BLOG_SLUG . '/', '', $query_string );

    query_posts($query_string);

    if ( is_single() )
    bp_core_load_template( 'single', true );
    else if ( is_category() || is_search() || is_day() || is_month() || is_year() )
    bp_core_load_template( 'archive', true );
    else
    bp_core_load_template( 'index', true );
    }
    }
    add_action( 'wp', 'bp_show_home_blog', 2 );

    Good call. Your code fixes the problem. Here’s what I had in my functions? I wonder how it got screwed up?

    function bp_show_home_blog() {

    global $bp, $query_string;

    if ( $bp->current_component == HOME_BLOG_SLUG ) {

    $pos = strpos( $query_string, ‘pagename=’ . HOME_BLOG_SLUG );

    if ( $pos !== false )

    $query_string = preg_replace( ‘/pagename=’ . HOME_BLOG_SLUG . ‘/’, ”, $query_string );

    query_posts($query_string);

    $single_check = strpos( $query_string, ‘&name=’ );

    if ( $single_check === false )

    bp_core_load_template( ‘index’, true );

    else

    bp_core_load_template( ‘single’, true );

    }

    }

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    Your code is missing the all-important add_action!

    You had the function defined, but nothing is executing it! hehe

    Yeah there’s at least three functions in the default bphome theme functions.php that you should copy over.

    Just copy the whole functions.php file over from bphome and you should be good to go!

    Remember to green light the thread and select “resolved”!

    Avatar of hatiro
    HaTiRo
    Participant

    @hatiro

    I had a similar issue after upgrading to the latest stable version. Comment link worked in additional blogs not using bp-home theme, but didn’t work on main blog, simply clicked on comment link and got nothing.

    Searched forums and this was the second post that was similar to my problem, but none of the solutions fixed it. After a bit of playing I noticed..

    In the dashboard there is a check box on the right hand side of the main edit blog admin page in a box called Blog Themes next to: WordPress mu Homepage. After checking this [active] check box, comments worked and were visible after clicking in the main blog..

    This may make sense to those suffering the same problem, sorry if its not that clear.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Comments won't display on main blog’ is closed to new replies.