Skip to:
Content
Pages
Categories
Search
Top
Bottom

Theme not showing correct template file

  • Avatar of John James Jacoby
    John James Jacoby
    Keymaster

    @johnjamesjacoby

    I’m using BPrc1, with a slightly modified BuddyPress home theme (mostly CSS only) and for some reason, it doesn’t use any other file other than index.php. It doesn’t use archive.php or single.php when it should be.

    I’ve reverted back to the MU theme, and it works totally like it should, so it seems this problem only exists within the BuddyPress theme.

    Suggestions where to start debugging? Any weird plugin conflicts I should be aware of or anything weird?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    I just ran a little test and bp is using single.php. In the functions.php file for the home theme there is a fn called bp_show_home_blog() which is where it detects what to load. Yours should look like this:

    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 );

    }

    }

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

    Avatar of John James Jacoby
    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Yes sir, this is exactly how I have mine. It is from the latest RC1 functions.php file it appears. (Side note: what does it do about archives, etc…?)

    Back on topic (mostly)… Here’s a question, and maybe this is the culprit. I’ve asked over on the WPMU forums and so far no one has bitten so maybe I’ll theorize here.

    I have two domains, testdomain.com, and testdomain2.com. testdomain.com originally had wordpress.org 2.7 installed on it, integrated with bbpress.org 1.0a6. I backed up my database and started my conversion process.

    When I installed WPMU and BuddyPress, I did so at testdomain2.com and I am confident I used the subdirectory option. Then when it was working and I had the test database all restored from my afore mentioned backup, and working with all the integration and everything, I moved all of the files from testdomain2.com, to testdomain1.com. With a few hours tweaking, everything appears to be working, but this and the fact that it is now installed as a subdomain install instead of subdirectory.

    Now, I can’t tell what the difference is between the two installs (subdirectory and subdomain.) The .htaccess files are the same, the database is the same, and the files all appear to be the same as well. What the heck does WPMU do where to have it know the difference? Could that be part of my problem? Ah!

    Avatar of John James Jacoby
    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Seems the answer to this problem was much simpler than my above psychotic rant, but I don’t quite have a good fix yet…

    The problem comes from using this function in bp-custom.php:

    function blog_to_news() {
    return 'news';
    }
    add_filter( 'bp_home_blog_slug', 'blog_to_news' );

    Using that, it seems, causes the whole thing to be a mess. I’ve echo’ed the HOME_BLOG_SLUG, and it is in-fact “news” so that isn’t to blame, but if I remove that little snippet of code, problem solved. But I really want my “/blog” to be “/news” without problem. Hrm…

    Also, and this might be common knowledge that I just now am figuring out, it seems that to switch from subdomain to subdirectory (in the event you only have the 1 main blog installed, editing wp_config.php define('VHOST', 'yes'); to define('VHOST', 'no'); will switch that over for you. Phew!)

    Avatar of John James Jacoby
    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Alright, so I went through and triple checked all of my site_url related settings, they were fine. So I moved all of the plugins from mu-plugins to _temp (except the core) visited the site, then moved them back, and all appears to be well. Is it possible that BuddyPress just got confused? I’d say it’s probably more likely that I’m going crazy…

    Next up… If I use the above blog_to_news function, I’ve got it working in the navbar, but the widgets in the blog still point to “blog/…” rather than “news/…” Funny thing is that they load just fine because I never updated the permalink structure to say “/news/%category%/%postname%/” but once I do that, it goes back to post 1 and doesn’t work again.

    So even if the permalink and HOME_BLOG_SLUG match, filtered or not, if it doesn’t route to “yourdomain.tld/blog/…” then it doesn’t want to use anything but index.php.

    Avatar of John James Jacoby
    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Finally tracked this one down! OMG was it hard!

    Basically, using /%category%/ doesn’t work in the permalinks anymore, if it ever did in the first place. That was my problem the entire time, and now I can safely rename my /blog to /news or /cheese or /beer or whatever…

    Phew… Should this be tracked? I’ve confirmed this on a stock install of BuddyPress/WPMU also to confirm.

    Also, that function you mentioned, basically bypasses archive.php, category.php, etc… And only serves up index.php and single.php…

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

You must be logged in to reply to this topic.