Skip to:

Opened 11 years ago

Closed 11 years ago

Last modified 8 years ago

#4928 closed defect (bug) (fixed)

Function that adds 'buddypress" to body tag is too greedy

Reported by: dcavins's profile dcavins Owned by:
Milestone: 1.7.1 Priority: normal
Severity: minor Version: 1.7
Component: Templates Keywords:


I've been adding the class buddypress to my themes manually via the functions.php file:

if ( function_exists( 'bp_is_blog_page' ) && !bp_is_blog_page() ) {
        $classes[] = 'buddypress';

and it looks like similar functionality has been added to bp-core-template with 1.7. However, the new implementation sets 'buddypress' nearly all the time in my installation:

// Add BuddyPress class if we are within a BuddyPress page
		if ( !empty( $bp_classes ) ) {
			$bp_classes[] = 'buddypress';

There are a lot of false positives that populate $bp_classes, like being logged in or visiting the home page (even if you're not logged in).

I definitely think adding 'buddypress' to the body class where appropriate is really helpful for theme developers.

Thanks for all of the excellent work in 1.7.


Change History (3)

#1 @DJPaul
11 years ago

  • Component changed from Core to Theme
  • Milestone changed from Awaiting Review to 1.7.1
  • Type changed from enhancement to defect (bug)

I don't think the body is meant to have the BuddyPress class on non-BP pages

#2 @boonebgorges
11 years ago

  • Resolution set to fixed
  • Status changed from new to closed

#3 @DJPaul
8 years ago

  • Component changed from Appearance - Template Parts to Templates
Note: See TracTickets for help on using tickets.