Skip to:
Content
Pages
Categories
Search
Top
Bottom

If Buddypress, then sidebar and css rules


  • Matt Edminster
    Participant

    @chiinook

    Is there a conditional function that checks to see whether the given page is a buddypress page of any kind?

    I need this for two applications. In the first case, I want my top level navigation link “Communities” to use the css class “active” as long as a buddypress page of any kind is active. In the second application, I want a sidebar I’ve registered to show up on all (but only) buddypress pages.

    Many thanks!

Viewing 3 replies - 1 through 3 (of 3 total)

  • Roger Coathup
    Participant

    @rogercoathup

    Take a look at this page: https://codex.buddypress.org/developer-docs/conditional-template-tags/

    Essentially, something like !bp_is_blog_page() will return TRUE when you are on any page that isn’t a WordPress blog page – i.e. when you are on any of the Social Network (BuddyPress) pages.

    Alternatively, the default theme already embeds some class information in the body tag – although there is no single one for a BuddyPress page, so you’d have to catch all the different classes.


    Bowe
    Participant

    @bowromir

    What Roger says is right.. that’s the way to go.. you can also use the conditional tags to display certain sidebars on certain components only:

    `
    <?php /* GROUP SIDEBAR */ if(bp_is_group()){
    if(!dynamic_sidebar(“Group Sidebar”)){
    ?>
    `
    It’s a great way to make your site more dynamic!


    Matt Edminster
    Participant

    @chiinook

    Thanks fellas … I’ll see what I can put together.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘If Buddypress, then sidebar and css rules’ is closed to new replies.
Skip to toolbar