Skip to:
Content
Pages
Categories
Search
Top
Bottom

Buddypress is loading wp-header() twice and wp-footer() doesn’t look loaded properly


  • kuching
    Participant

    @substrato

    I’m using latest buddypress and wordpress
    I’m not using a custom theme, I’m using the buddypress template pack
    I’m also running bbpress latest

    I’ve created a header-buddypress.php and a footer-buddypress.php to add a few html blocks (padder, etc) to match my desgin while buddypress pages are loaded

    However, I just noticed that ALL of my buddypress pages were actually loading the header twice AFTER the body html tag. I think it’s firing wp-header() twice as I have a series of links, javascripts and meta after the body tag is started but no extra html tags and there’s no second body tag element. I suspect there’s no wp-footer() called either because the footer loaded is truncated right before that.

    I have no idea why this is happening. I tried to eliminate the header-buddypress and footer-buddypress but that didn’t eliminate the problem.

    I disabled WordPress SEO by Yoast plugin that seem to have fixed the problem with the header but I’m not sure whether the issue is solved entirely. For example, from the forums subscriptions and favorites while in the Buddypress member profile page, if I try to unsubscribe/unfavorite a topic, I get this error upon redirect (unsubscription works fine)
    `Notice: Undefined variable: redirect in /path_to_my_installation/content/plugins/bbpress/bbp-includes/bbp-user-functions.php on line 510`

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

  • kuching
    Participant

    @substrato


    @mercime
    Participant

    @mercime

    == I’m not using a custom theme, I’m using the buddypress template pack ==

    @substrato Not clear. What theme are you using? Site URL?

    – Only use the BuddyPress Template Pack plugin when you want to make your WP theme compatible with BuddyPress. So if you’re testing/using the BuddyPress Default theme, you do not need to use the BP template pack plugin.

    – Creating header-buddypress.php and sidebar-buddypress.php is appropriate for some themes and inappropriate for others, all depends on the HTML structure of the theme.


    kuching
    Participant

    @substrato

    I’ve developed my own theme, I just copied the files provided into my own theme, then added a simple div tag in header-buddypress and closed in footer-buddypress to encapsulate it inside my existing css blocks

    if I don’t create these two files buddypress will look funny

    sorry for the confusione about my sentence above, I meant I’m not using a third party theme, I’m developing my own and embedding buddypress into it with BP Template Pack

    other than the issues mentioned above, my buddpress and wordpress installation are working fine; the duplicate wp_head is not really giving me serious issues (apart from that redirect problem at the moment), however it’s wrong to have repeated js and css in a page


    @mercime
    Participant

    @mercime

    == the duplicate wp_head is not really giving me serious issues (apart from that redirect problem at the moment), however it’s wrong to have repeated js and css in a page ==

    @substrato Re duplicate wp_head, how did you create header-buddypress.php? I do it by opening up header.php file and Save As > header-buddypress.php then at the bottom of that new file, add the necessary HTML tags which are not available in the BP templates. A possibility could be that you replicated wp_head in your our header-buddypress.php which I assumed you checked already?


    kuching
    Participant

    @substrato

    my header-buddypress.php:

    starts with `include ( ‘header.php’ );` then some html tag, no php
    rather than copying the contents of header.php and have duplicate code I thought it’s better to use include

    same for footer-buddypress.php, I first close the html tags I had openend in header-buddypress.php then include the footer.php

    there shouldn’t be duplicates of `wp_head()`; either I type `wp_head()` or `include( ‘header.php’ )` where `wp_head()` is called once, what would be the difference?

    however, I just noticed that the members page / activity page is ok; what is not ok are the individual member profile pages

    ‘header’ does not generally call header a second time. Duplicate code shouldn’t be an issue, the point of’-buddypress’ suffix is so you can call different versions of a header file – header.php or header-buddypress.php

    I think you need to show copies of your main files so it’s clear what you have done use pastebin to show copies of header, footer, a general page and a BP directory index.


    @mercime
    Participant

    @mercime

    == My header-buddypress.php: starts with include ( ‘header.php’ ); then some html tag, no php ==

    And therein lays the answer to the strange behavior. What hnla said above. header.php is a special template file which is not meant to be included in another file except via get_header call. To resolve your issue, create header-buddypress.php the way I mentioned above. Do the same for your footer-buddypress.php, footer.php is another special file which should only be called via get_footer()

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Buddypress is loading wp-header() twice and wp-footer() doesn’t look loaded properly’ is closed to new replies.
Skip to toolbar