for each css element you modify, you have to put it with the ” !important ” tag, because the core css have it, and you can not override without it too…
Sorry. The first if statement does work but the template tag “bp_is_group_members()” does not. Nor do most of the template tags do not work.
Thanks Nexia, The trick I’m looking for is in how to identify in the head which page I’m now on and to use and if statement to load something additional. For the main pages like Activity, Groups, Forums, I can use the page slugs in my if statement successfully. Just not in the sub sections.
The code you’re looking for already exists in header.php… in the navigation bar section. It’s used for navigation tab highlighting… i.e… adding a class like “current” or whatever to the LI tags. Just copy/paste and modify.
Mmm very original.. I’ve currently done this by modifying the templates and changing divs, but this is a better approach me thinks! Nice
Check out different CSS for posts and pages – http://digwp.com/2010/02/custom-css-per-post/
You could also just use body classes and put all styles in the same stylesheet.
@Boone: Yah… actually… I do that all the time. Usually just for the odd tweak tho’… something I want to hide on a .home page or whatever.
I also used this for identifying top level navigation.
<?php if ( bp_is_page( BP_FORUMS_SLUG ) ) : ?>
Problem for me is when you get into the Member sub navigation. I looked at your tab highlighting and agree that would also work. But I don’t see anything in the head that deals with the subsection pages.
So I’m almost there. I’m looking at mercime’s link know to see how they are doing it.
I think you are making more work for yourself than necesary. Andy has included specific classes in the Body class (as david alluded to) and you can specify styling for each page class that way, you cna also double up classes where you want consistency and no php will be required.
@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.