BuddyPress

Conditional Template Tags

ContentsDeveloper Docs → Conditional Template Tags

Conditional template tags allow you to show specific content on specific pages. The following tags are available in BuddyPress (1.2+):

bp_is_my_profile()
bp_is_home() - same as bp_is_my_profile()

bp_is_blog_page() - catch all for a WP blog page in BP

bp_is_directory()

bp_is_serialized($data) - checks to see if $data is serialized

bp_is_front_page()
bp_is_activity_front_page()

bp_is_page($page) - checks if $bp->current_component matches $page

bp_is_active( $component ) - checks if a BP $component is active

bp_is_profile_component()
bp_is_activity_component()
bp_is_blogs_component()
bp_is_messages_component()
bp_is_friends_component()
bp_is_groups_component()
bp_is_settings_component()

bp_is_member()

bp_is_user_activity()
bp_is_user_friends_activity()

bp_is_activity_permalink()

bp_is_user_profile()
bp_is_profile_edit()
bp_is_change_avatar()

bp_is_user_groups()
bp_is_group()
bp_is_group_home()
bp_is_group_create()
bp_is_group_admin_page()
bp_is_group_forum()
bp_is_group_activity()
bp_is_group_forum_topic()
bp_is_group_forum_topic_edit()
bp_is_group_members()
bp_is_group_invites()
bp_is_group_membership_request()
bp_is_group_leave()
bp_is_group_single()

bp_is_user_blogs()
bp_is_user_recent_posts()
bp_is_user_recent_commments()
bp_is_create_blog()

bp_is_user_friends()

bp_is_friend_requests()

bp_is_user_messages()
bp_is_messages_inbox()
bp_is_messages_sentbox()
bp_is_notices()
bp_is_messages_compose_screen()

bp_is_single_item()

bp_is_activation_page()
bp_is_register_page()

If you wanted to see if this was a single group page, in your template you could do:

<?php if ( bp_is_group_home() ) : ?>Show this on group home pages <? endif; ?>

Or if you wanted to show something on every single group page, regardless if it was the home page or not:

<?php if ( bp_is_groups_component() && bp_is_single_item() ) : ?> Show this on all single group pages <?php endif; ?>

There are no specific checks on group names etc yet, but you can do this:

<?php if ( bp_is_groups_component() && 'my-group' == bp_current_item() ) : ?> This is my-group <?php endif; ?>