Skip to:

Opened 14 years ago

Closed 13 years ago

#2468 closed enhancement (fixed)

Additional css class tokens for body tag

Reported by: hnla's profile hnla Owned by:
Milestone: 1.5 Priority: minor
Severity: normal Version:
Component: Core Keywords: close 2nd-opinion
Cc: hugoashmore@…


At the moment bp-core-templatetags.php assigns a number of classes to be added to the body tag.

Issue is that these classes are all a tad random or rather they tend to output a token that is very specific to the bp_is_*, this results in having heavy handed grouping of selectors to cover simple rules and adds bloat to the stylesheet.

Proposal is that overall it would benefit styling if there were some more generic classes to cover general sections of BP i.e in any screen that comes under the members account area body would carry the token 'my-account' I have modified my templatetags file thus:

{{{ if ( bp_is_settings_component() && !bp_is_blog_page() )

$bp_classes[] = 'my-account settings';

if ( bp_is_user_friends() )

$bp_classes[] = 'my-account my-friends';

etc, for all items that fall under the member account group of screens.

Ideally I would output an id token on probably the html tag which is where I normally denote major sections or pages that group logically.

I have set this ticket to 'minor' however would hope that it's also a relatively minor additional piece of work that does make theming less of a chore.

As it is I have not been able to locate where the followers/following plugin manages to declare their tokens so have to add an extra unnecessary set of grouped selectors to ensure these screens pick up the rulesets.



Change History (8)

#1 @hnla
14 years ago

  • Milestone changed from 1.3 to 1.2.5
  • Summary changed from Additional css classes for body tag to Additional css class tokens for body tag

#2 @johnjamesjacoby
14 years ago

  • Milestone changed from 1.2.5 to 1.3

Bumping this to 1.3.

Great suggestion but a little too much to look through so soon before a point release.

This function could be expanded and probably simplified a lot, just by using the $bp->current_component and $bp->current_action variables instead, with a few additional checks to fill any gaps.

If you want to come up with a better complete solution for this, I'd love to see what you can come up with.

#3 @DJPaul
13 years ago

I'm about to commit some improvements to this, but I think it probably needs a revisit around BP 1.4, after custom post types or a component class, to simplify the code.

#4 @djpaul
13 years ago

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

(In [3701]) Adds missing <body> classes. Fixes #2468.

#5 @DJPaul
13 years ago

  • Milestone changed from 1.3 to 1.4
  • Resolution fixed deleted
  • Status changed from closed to reopened

#6 @DJPaul
13 years ago

  • Keywords close reporter-feedback 2nd-opinion added
  • Severity set to normal

Suggest we close this unless someone comes up with ideas for new useful <body> classes

#7 @hnla
13 years ago

  • Keywords reporter-feedback removed

I need to revisit but thought a while back that I still had a requirement for classes when running over profile pages, but equally may have found an easier workaround so yes think this is safely closed - but may reopen if I do see an advantage / suggestion for more.

#8 @DJPaul
13 years ago

  • Milestone changed from 1.6 to 1.5
  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.