Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Alternate Stylesheets for different sections


@mercime
Keymaster

@mercime

@Michaelmarian, For the Members subsection, easiest way is as Boone Gorges mentioned using body classes: e.g. Member’s Profile page use selector body.profile; Member’s Blog Page use selector body.my-blogs; Member’s Message Page use selector body.messages; etc.

However, if you still want to use conditional statements see

https://codex.buddypress.org/developer-docs/conditional-template-tags/

Thing is, locate_template array did not work for me in all the different incarnations of custom child themes I made before so this method might help you too

<?php
if (bp_is_profile_component()) {
include ('mystuff1.php');
}
elseif (bp_is_activity_component()) {
include ('mystuff2.php');
}
elseif (bp_is_friends_component()) {
include ('mystuff3.php');
}
else {
include ('mystuff4.php');
}
?>

– For more specificity you could probably add – && bp_is_page(‘members’) – or whatever slug you used

– Add wp_reset_query(); right after the opening <?php if this query is placed latter part of the page or add the reset just before ?> if placed near top of the page.

Skip to toolbar