Can you paste your code? The original classes shouldn’t be lost. The filter just adds new ones whilst retaining what classes are already in place.
Well, i use the snippet in my bp-custom.php, which is empty except the snippet. i use the one you guys gave me. What code do you want me to paste, the header.php one?
Thanks for the effort btw, much appreciated.
@jerryskate if you could post your filter (what you have in bp-custom) and your body tag (from your header.php) i’ll take a look…
cc @modemlooper @hnla – anyone for some healthy foods from the food-pyramid guy? I prefer a good old fashioned burger and fries myself 🙂
This in bp-custom:
function add_body_classes( $classes ) {
if ( bp_is_member() )
$classes[] = 'this-is-a-member-profile';
if ( bp_is_member() )
$classes[] = 'member-profile-of-' . bp_displayed_user_username();
}
add_filter( 'body_class', 'add_body_classes', 12 );
And this in header:
<body <?php page_bodyclass(); ?>>
In bp-custom right after the line $classes[] = 'member-profile-of-' . bp_displayed_user_username();
add this:
return $classes;
Ok, a bit better 🙂 Still having my profilename outside the classes, but got all the old ones back.
<body jerryclass="activity bp-user my-activity my-account just-me buddypress bbp-user-page single singular bbpress page page-id-5 page-template-default logged-in admin-bar no-customize-support bp-wall adminbar-enable not-responsive this-is-a-member-profile member-profile-of-" class=" customize-support" data-twttr-rendered="true">
OK, I think I might know what is happening. Try this as the whole thing put together:
function add_body_classes( $classes ) {
if ( bp_is_member() ) {
$classes[] = 'this-is-a-member-profile';
$classes[] = 'member-profile-of-' . bp_get_displayed_user_username();
}
return $classes;
}
add_filter( 'body_class', 'add_body_classes', 12 );
Henry, your a genius! It works! It gave me .member-profile-of-jerry as a class to use. Finally! Thanks so much. I have one bug left to solve, a permalink issue, but won’t bother the forum until i tried deactivating plugins and some other things. Again, thanks!
@jerryskate great! glad you got it working 🙂