I need a conditional for buddypress pages like is_bp_page

Hi, I need a conditional for buddypress pages like is_bp_page to work with my theme. This exists?

I have hook single, archives and home page. None of the wordpress pages are afected. I need avoid hook the buddypress pages.

Single: http://www.redminka.com/juan_minka/2013/08/rm-test

archive:http://www.redminka.com/pub/

WP page: http://www.redminka.com/post-vide/

Buddypress page: http://www.redminka.com/usuarios/juan_minka/

Thanks

  • Elliott Bristow
    • The Bug Hunter

    Hi ggsalas,

    I’m not sure if BuddyPress has it’s own native function to check if a page is a part of BuddyPress (I’m sure someone else will correct me if I’m wrong)… but you could create your own based on the body class, since all pages created by BuddyPress should be given the “buddypress” class.

    Here’s an example you could use:

    <?php // http://digwp.com/2009/08/wordpress-body-class-plus/
    function is_bp_page() {
    if(function_exists('body_class')) {
    ob_start(); body_class();
    $class = ob_get_contents();
    ob_end_clean();
    if($class) {
    if(preg_match("/buddypress/i", $class)) {
    return true;
    }
    }
    }
    return false;
    } ?>

    Hope that helps!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.