Template Tag Reference
(Work in Progress)
General Template Tags
- bp_get_loggedin_user_nav()
- Uses the $bp->bp_nav global to render out the navigation within a BuddyPress install.
Each component adds to this navigation array within its own [component_name]_setup_nav() function.This navigation array is the top level navigation, so it contains items such as:
[Blog, Profile, Messages, Groups, Friends] …The function will also analyze the current component the user is in, to determine whether
or not to highlight a particular nav item. - bp_get_displayed_user_nav()
- Uses the $bp->bp_users_nav global to render out the user navigation when viewing another user other than
yourself. - bp_get_options_nav()
- Uses the $bp->bp_options_nav global to render out the sub navigation for the current component.
Each component adds to its sub navigation array within its own [component_name]_setup_nav() function.This sub navigation array is the secondary level navigation, so for profile it contains:
[Public, Edit Profile, Change Avatar]The function will also analyze the current action for the current component to determine whether
or not to highlight a particular sub nav item.@uses bp_get_user_nav() Renders the navigation for a profile of a currently viewed user. - bp_get_options_title
- bp_site_name
- Returns the ‘Site Title’ set in Settings > General.
- bp_is_home
- See conditional tags.
- bp_last_activity()
- bp_user_link()
- bp_get_loggedin_user_link()
- bp_loggedinuser_link()
- bp_get_displayed_user_link()
- bp_core_get_wp_profile()
- bp_get_profile_header()
- bp_exists()
- bp_format_time()
- bp_word_or_name()
- This will display either a word, or a name to provide better context. for example, “My friends” or “Bob’s friends”
- bp_your_or_their()
- bp_get_plugin_sidebar()
- This will try and find the file plugin-sidebar.php and display it if it’s found.
- bp_is_page()
- See conditional tags.
- bp_is_blog_page()
- See conditional tags.
- bp_page_title()
- bp_get_page_title()
- bp_styles()
- bp_has_custom_signup_page()
- bp_signup_page()
- bp_has_custom_activation_page()
- bp_activation_page()
- bp_search_form()
- bp_search_form_action()
- bp_search_form_type_select()
- bp_login_bar()
- bp_profile_wire_can_post()
- This is deprecated, for more info, see the BuddyPress Backwards Compatibility plugin.
- bp_nav_items()
- This is deprecated, you should put these navigation items in your template header.php for easy editing.
- bp_custom_profile_boxes()
- bp_custom_profile_sidebar_boxes()
- bp_get_userbar()
- bp_get_optionsbar()
- bp_is_directory()
- See conditional tags.
- bp_create_excerpt()
- Fakes an excerpt on any content. Will not truncate words.
- bp_is_serialized()
- Checks to see if the data passed has been serialized.
- bp_rewind_site_members
- bp_has_site_members
- bp_the_site_member
- bp_site_members
- bp_site_members_pagination_count
- bp_get_site_members_pagination_links
- bp_site_members_pagination_links
- bp_get_the_site_member_user_id
- bp_the_site_member_user_id
- bp_get_the_site_member_avatar
- bp_the_site_member_avatar
- bp_get_the_site_member_link
- bp_the_site_member_link
- bp_get_the_site_member_name
- bp_the_site_member_name
- bp_get_the_site_member_last_active
- bp_the_site_member_last_active
- bp_get_the_site_member_registered
- bp_the_site_member_registered
- bp_the_site_member_add_friend_button
- bp_get_the_site_member_total_friend_count
- bp_the_site_member_total_friend_count
- bp_the_site_member_random_profile_data
- bp_the_site_member_hidden_fields
- bp_directory_members_search_form
- bp_home_blog_url
- bp_displayed_user_id
- bp_current_user_id
- bp_loggedin_user_id
- bp_displayed_user_domain
- bp_loggedin_user_domain
- bp_user_fullname
- bp_displayed_user_fullname
- bp_get_loggedin_user_fullname
- bp_loggedin_user_fullname
- bp_current_component
- bp_current_action
- bp_action_variables
Avatar Template Tags
- bp_has_options_avatar()
- Check to see if there is an options avatar. An options avatar is an avatar for something
like a group, or a friend. Basically an avatar that appears in the sub nav options bar. - bp_get_options_avatar()
- bp_comment_author_avatar()
- bp_post_author_avatar()
- bp_loggedin_user_avatar()
- bp_get_loggedin_user_avatar()
- bp_displayed_user_avatar()
- bp_get_displayed_user_avatar()
- bp_avatar_admin_step()
- bp_get_avatar_admin_step()
- bp_avatar_to_crop()
- bp_get_avatar_to_crop()
- bp_avatar_to_crop_src()
- bp_get_avatar_to_crop_src()
- bp_avatar_cropper()
Signup Template Tags
- bp_signup_username_value
- bp_get_signup_username_value
- bp_signup_email_value
- bp_get_signup_email_value
- bp_signup_with_blog_value
- bp_get_signup_with_blog_value
- bp_signup_blog_url_value
- bp_get_signup_blog_url_value
- bp_get_signup_blog_title_value
- bp_signup_blog_title_value
- bp_get_signup_blog_privacy_value
- bp_signup_blog_privacy_value
- bp_get_signup_avatar_dir_value
- bp_signup_avatar_dir_value
- bp_get_current_signup_step
- bp_current_signup_step
- bp_get_signup_avatar
- bp_signup_avatar
Custom Loop Template Class
BP_Core_Members_Template
is_ functions
These is_ functions are used to determine the type of page currently being served within the template.
- bp_is_user_profile
- Used to determine if the current page is a profile page.
- Returns:
- TRUE if current page is a profile page
- FALSE otherwise
- bp_is_activity
- Used to determine if the current page is the activity page.
- Returns:
- TRUE if current page is the activity page
- FALSE otherwise
- bp_is_blogs
- Used to determine if the current page is the blogs page.
- Returns:
- TRUE if current page is the blogs page
- FALSE otherwise
- bp_is_wire
- Used to determine if the current page is a wire page.
- Returns:
- TRUE if current page is a wire page
- FALSE otherwise
- bp_is_messages
- Used to determine if the current page is a messages page.
- Returns:
- TRUE if current page is a messages page
- FALSE otherwise
- bp_is_friends
- Used to determine if the current page is a friends page.
- Returns:
- TRUE if current page is a friends page
- FALSE otherwise
- bp_is_groups
- Used to determine if the current page is the groups page.
- Returns:
- TRUE if current page is the groups page
- FALSE otherwise
- bp_is_settings
- Used to determine if the current page is the user settings page.
- Returns:
- TRUE if current page is the user settings page page
- FALSE otherwise
- bp_is_my_activity
- Used to determine if the current page is the my activity page.
- Returns:
- TRUE if current page is the my activity page
- FALSE otherwise
- bp_is_friends_activity
- Used to determine if the current page is a friends activity page.
- Returns:
- TRUE if current page is a friends activity page
- FALSE otherwise
- bp_is_profile_edit
- Used to determine if the current page is the profile edit page.
- Returns:
- TRUE if current page is the profile edit page
- FALSE otherwise
- bp_is_change_avatar
- Used to determine if the current page is the change avatar page.
- Returns:
- TRUE if current page is the change avatar page
- FALSE otherwise
- bp_is_profile_wire
- Used to determine if the current page is a profile wire page.
- Returns:
- TRUE if current page is a profile wire page
- FALSE otherwise
- bp_is_group_single()
- Used to determine if the current page is a single group page.
- Returns:
- TRUE if current page is a single group page
- FALSE otherwise
- bp_is_group_home
- Used to determine if the current page is a group homepage.
- Returns:
- TRUE if current page is a group homepage
- FALSE otherwise
- bp_is_group_create
- Used to determine if the current page is a group create page.
- Returns:
- TRUE if current page is a group create page
- FALSE otherwise
- bp_is_group_admin_page
- Used to determine if the current page is a group admin page.
- Returns:
- TRUE if current page is a group admin page
- FALSE otherwise
- bp_is_group_wire
- Used to determine if the current page is a group wire page.
- Returns:
- TRUE if current page is a group wire page
- FALSE otherwise
- bp_is_group_forum
- Used to determine if the current page is a group forum page.
- Returns:
- TRUE if current page is a group forum page
- FALSE otherwise
- bp_is_group_forum_topic
- Used to determine if the current page is a group form topic page.
- Returns:
- TRUE if current page is a group forum topic page
- FALSE otherwise
- bp_is_group_members
- Used to determine if the current page is a group members page.
- Returns:
- TRUE if current page is a group members page
- FALSE otherwise
- bp_is_group_invites
- Used to determine if the current page is a group invite page.
- Returns:
- TRUE if current page is a group invite page
- FALSE otherwise
- bp_is_group_leave
- Used to determine if the current page is a \’leave the group\’ page.
- Returns:
- TRUE if current page is a \’leave the group\’ page
- FALSE otherwise
- bp_is_my_blogs
- Used to determine if the current page is the my blogs page.
- Returns:
- TRUE if current page is the my blogs page
- FALSE otherwise
- bp_is_recent_posts
- Used to determine if the current page is the recent posts page.
- Returns:
- TRUE if current page is the recent posts page
- FALSE otherwise
- bp_is_recent_comments
- Used to determine if the current page is the recent comments page.
- Returns:
- TRUE if current page is the recent comments page
- FALSE otherwise
- bp_is_create_blog
- Used to determine if the current page is the \’create a blog\’ page.
- Returns:
- TRUE if current page is \’create a blog\’ page
- FALSE otherwise
- bp_is_friends_screen
- Used to determine if the current page is the friends page.
- Returns:
- TRUE if current page is the friends page
- FALSE otherwise
- bp_is_friend_requests
- Used to determine if the current page is the friend requests page.
- Returns:
- TRUE if current page is the friend requests page
- FALSE otherwise
- bp_is_inbox
- Used to determine if the current page is the messages inbox page.
- Returns:
- TRUE if current page the messages inbox page
- FALSE otherwise
- bp_is_sentbox
- Used to determine if the current page is the messages sentbox page.
- Returns:
- TRUE if current page is the messages sentbox page
- FALSE otherwise
- bp_is_notices
- Used to determine if the current page is the notices page.
- Returns:
- TRUE if current page is the notices page
- FALSE otherwise
- bp_is_compose_screen
- Used to determine if the current page is the message compose page.
- Returns:
- TRUE if current page is the message compose page
- FALSE otherwise
- bp_is_site_item
- Used to determine if it is a site_item (TODO: need more info).
- Returns:
- TRUE if is a site item
- FALSE otherwise
bp_is_register_page()Used to determine if the current page is the registration page.
- Returns:
- TRUE if current page is the registration page
- FALSE otherwise
bp_is_activation_page()Used to determine if the current page is the activation page.
- Returns:
- TRUE if current page is the activation page
- FALSE otherwise
bp_get_the_body_classbp_the_body_classUses the above is_() functions to output a body class for each page
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) // deprecated 1.7 use bp_is_current_component( 'activity' ) bp_is_current_component( 'activity' ) ) 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() // deprecated 1.5 use bp_is_single_activity() 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; ?>