本文整理汇总了PHP中bp_get_directory_title函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_directory_title函数的具体用法?PHP bp_get_directory_title怎么用?PHP bp_get_directory_title使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_directory_title函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dummy_post
/**
* Update the global $post with dummy data
*
* @since BuddyPress (1.7)
*/
public function dummy_post()
{
// Registration page
if (mpp_is_gallery_directory()) {
$title = __('Gallery Directory', 'mediapress');
}
bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bp_get_directory_title('mediapress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => mpp_get_gallery_post_type(), 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
}
示例2: bp_modify_page_title
//.........这里部分代码省略.........
}
$title = '';
// Displayed user
if ( bp_get_displayed_user_fullname() && ! is_404() ) {
// Get the component's ID to try and get its name
$component_id = $component_name = bp_current_component();
// Use the component nav name
if ( ! empty( $bp->bp_nav[$component_id] ) ) {
// Remove counts that are added by the nav item
$span = strpos( $bp->bp_nav[ $component_id ]['name'], '<span' );
if ( false !== $span ) {
$component_name = substr( $bp->bp_nav[ $component_id ]['name'], 0, $span - 1 );
} else {
$component_name = $bp->bp_nav[ $component_id ]['name'];
}
// Fall back on the component ID
} elseif ( ! empty( $bp->{$component_id}->id ) ) {
$component_name = ucwords( $bp->{$component_id}->id );
}
// Append action name if we're on a member component sub-page
if ( ! empty( $bp->bp_options_nav[ $component_id ] ) && ! empty( $bp->canonical_stack['action'] ) ) {
$component_subnav_name = wp_filter_object_list( $bp->bp_options_nav[ $component_id ], array( 'slug' => bp_current_action() ), 'and', 'name' );
if ( $component_subnav_name ) {
$component_subnav_name = array_shift( $component_subnav_name );
} else {
$component_subnav_name = '';
}
} else {
$component_subnav_name = '';
}
// If on the user profile's landing page, just use the fullname
if ( bp_is_current_component( $bp->default_component ) && bp_get_requested_url() === bp_displayed_user_domain() ) {
$title = bp_get_displayed_user_fullname();
// Use component name on member pages
} else {
// If we have a subnav name, add it separately for localization
if ( ! empty( $component_subnav_name ) ) {
// translators: construct the page title. 1 = user name, 2 = component name, 3 = separator, 4 = component subnav name
$title = strip_tags( sprintf( __( '%1$s %3$s %2$s %3$s %4$s', 'buddypress' ), bp_get_displayed_user_fullname(), $component_name, $sep, $component_subnav_name ) );
} else {
// translators: construct the page title. 1 = user name, 2 = component name, 3 = separator
$title = strip_tags( sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), bp_get_displayed_user_fullname(), $component_name, $sep ) );
}
}
// A single group
} elseif ( bp_is_active( 'groups' ) && ! empty( $bp->groups->current_group ) && ! empty( $bp->bp_options_nav[ $bp->groups->current_group->slug ] ) ) {
$subnav = isset( $bp->bp_options_nav[ $bp->groups->current_group->slug ][ bp_current_action() ]['name'] ) ? $bp->bp_options_nav[ $bp->groups->current_group->slug ][ bp_current_action() ]['name'] : '';
// translators: 1 = group name, 2 = group nav section name, 3 = separator
$title = sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), $bp->bp_options_title, $subnav, $sep );
// A single item from a component other than groups
} elseif ( bp_is_single_item() ) {
// translators: 1 = component item name, 2 = component nav section name, 3 = separator
$title = sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), $bp->bp_options_title, $bp->bp_options_nav[ bp_current_item() ][ bp_current_action() ]['name'], $sep );
// An index or directory
} elseif ( bp_is_directory() ) {
$current_component = bp_current_component();
// No current component (when does this happen?)
if ( empty( $current_component ) ) {
$title = _x( 'Directory', 'component directory title', 'buddypress' );
} else {
$title = bp_get_directory_title( $current_component );
}
// Sign up page
} elseif ( bp_is_register_page() ) {
$title = __( 'Create an Account', 'buddypress' );
// Activation page
} elseif ( bp_is_activation_page() ) {
$title = __( 'Activate your Account', 'buddypress' );
// Group creation page
} elseif ( bp_is_group_create() ) {
$title = __( 'Create a Group', 'buddypress' );
// Blog creation page
} elseif ( bp_is_create_blog() ) {
$title = __( 'Create a Site', 'buddypress' );
}
// Some BP nav items contain item counts. Remove them
$title = preg_replace( '|<span>[0-9]+</span>|', '', $title );
return apply_filters( 'bp_modify_page_title', $title . ' ' . $sep . ' ', $title, $sep, $seplocation );
}
示例3: directory_dummy_post
/**
* Update the global $post with directory data.
*
* @since BuddyPress (1.7.0)
*/
public function directory_dummy_post()
{
bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bp_get_directory_title('members'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
}
示例4: bp_get_title_parts
/**
* Get the title parts of the BuddyPress displayed page
*
* @since 2.4.3
*
* @param string $seplocation Location for the separator.
* @return array the title parts
*/
function bp_get_title_parts($seplocation = 'right')
{
$bp = buddypress();
// Defaults to an empty array.
$bp_title_parts = array();
// If this is not a BP page, return the empty array.
if (bp_is_blog_page()) {
return $bp_title_parts;
}
// If this is a 404, return the empty array.
if (is_404()) {
return $bp_title_parts;
}
// If this is the front page of the site, return the empty array.
if (is_front_page() || is_home()) {
return $bp_title_parts;
}
// Return the empty array if not a BuddyPress page.
if (!is_buddypress()) {
return $bp_title_parts;
}
// Now we can build the BP Title Parts
// Is there a displayed user, and do they have a name?
$displayed_user_name = bp_get_displayed_user_fullname();
// Displayed user.
if (!empty($displayed_user_name) && !is_404()) {
// Get the component's ID to try and get its name.
$component_id = $component_name = bp_current_component();
// Set empty subnav name.
$component_subnav_name = '';
if (!empty($bp->members->nav)) {
$primary_nav_item = $bp->members->nav->get_primary(array('slug' => $component_id), false);
$primary_nav_item = reset($primary_nav_item);
}
// Use the component nav name.
if (!empty($primary_nav_item->name)) {
$component_name = _bp_strip_spans_from_title($primary_nav_item->name);
// Fall back on the component ID.
} elseif (!empty($bp->{$component_id}->id)) {
$component_name = ucwords($bp->{$component_id}->id);
}
if (!empty($bp->members->nav)) {
$secondary_nav_item = $bp->members->nav->get_secondary(array('parent_slug' => $component_id, 'slug' => bp_current_action()), false);
if ($secondary_nav_item) {
$secondary_nav_item = reset($secondary_nav_item);
}
}
// Append action name if we're on a member component sub-page.
if (!empty($secondary_nav_item->name) && !empty($bp->canonical_stack['action'])) {
$component_subnav_name = $secondary_nav_item->name;
}
// If on the user profile's landing page, just use the fullname.
if (bp_is_current_component($bp->default_component) && bp_get_requested_url() === bp_displayed_user_domain()) {
$bp_title_parts[] = $displayed_user_name;
// Use component name on member pages.
} else {
$bp_title_parts = array_merge($bp_title_parts, array_map('strip_tags', array($displayed_user_name, $component_name)));
// If we have a subnav name, add it separately for localization.
if (!empty($component_subnav_name)) {
$bp_title_parts[] = strip_tags($component_subnav_name);
}
}
// A single item from a component other than Members.
} elseif (bp_is_single_item()) {
$component_id = bp_current_component();
if (!empty($bp->{$component_id}->nav)) {
$secondary_nav_item = $bp->{$component_id}->nav->get_secondary(array('parent_slug' => bp_current_item(), 'slug' => bp_current_action()), false);
if ($secondary_nav_item) {
$secondary_nav_item = reset($secondary_nav_item);
}
}
$single_item_subnav = '';
if (!empty($secondary_nav_item->name)) {
$single_item_subnav = $secondary_nav_item->name;
}
$bp_title_parts = array($bp->bp_options_title, $single_item_subnav);
// An index or directory.
} elseif (bp_is_directory()) {
$current_component = bp_current_component();
// No current component (when does this happen?).
$bp_title_parts = array(_x('Directory', 'component directory title', 'buddypress'));
if (!empty($current_component)) {
$bp_title_parts = array(bp_get_directory_title($current_component));
}
// Sign up page.
} elseif (bp_is_register_page()) {
$bp_title_parts = array(__('Create an Account', 'buddypress'));
// Activation page.
} elseif (bp_is_activation_page()) {
$bp_title_parts = array(__('Activate Your Account', 'buddypress'));
// Group creation page.
} elseif (bp_is_group_create()) {
//.........这里部分代码省略.........
示例5: bp_modify_page_title
/**
* Filter the page title for BuddyPress pages.
*
* @since 1.5.0
*
* @see wp_title()
* @global object $bp BuddyPress global settings.
*
* @param string $title Original page title.
* @param string $sep How to separate the various items within the page title.
* @param string $seplocation Direction to display title.
* @return string New page title.
*/
function bp_modify_page_title($title = '', $sep = '»', $seplocation = 'right')
{
global $bp, $paged, $page, $_wp_theme_features;
// If this is not a BP page, just return the title produced by WP.
if (bp_is_blog_page()) {
return $title;
}
// If this is a 404, let WordPress handle it.
if (is_404()) {
return $title;
}
// If this is the front page of the site, return WP's title.
if (is_front_page() || is_home()) {
return $title;
}
// Return WP's title if not a BuddyPress page.
if (!is_buddypress()) {
return $title;
}
// Setup an empty title parts array.
$title_parts = array();
// Is there a displayed user, and do they have a name?
$displayed_user_name = bp_get_displayed_user_fullname();
// Displayed user.
if (!empty($displayed_user_name) && !is_404()) {
// Get the component's ID to try and get its name.
$component_id = $component_name = bp_current_component();
// Set empty subnav name.
$component_subnav_name = '';
// Use the component nav name.
if (!empty($bp->bp_nav[$component_id])) {
$component_name = _bp_strip_spans_from_title($bp->bp_nav[$component_id]['name']);
// Fall back on the component ID.
} elseif (!empty($bp->{$component_id}->id)) {
$component_name = ucwords($bp->{$component_id}->id);
}
// Append action name if we're on a member component sub-page.
if (!empty($bp->bp_options_nav[$component_id]) && !empty($bp->canonical_stack['action'])) {
$component_subnav_name = wp_filter_object_list($bp->bp_options_nav[$component_id], array('slug' => bp_current_action()), 'and', 'name');
if (!empty($component_subnav_name)) {
$component_subnav_name = array_shift($component_subnav_name);
}
}
// If on the user profile's landing page, just use the fullname.
if (bp_is_current_component($bp->default_component) && bp_get_requested_url() === bp_displayed_user_domain()) {
$title_parts[] = $displayed_user_name;
// Use component name on member pages.
} else {
$title_parts = array_merge($title_parts, array_map('strip_tags', array($displayed_user_name, $component_name)));
// If we have a subnav name, add it separately for localization.
if (!empty($component_subnav_name)) {
$title_parts[] = strip_tags($component_subnav_name);
}
}
// A single group.
} elseif (bp_is_active('groups') && !empty($bp->groups->current_group) && !empty($bp->bp_options_nav[$bp->groups->current_group->slug])) {
$subnav = isset($bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name']) ? $bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name'] : '';
$title_parts = array($bp->bp_options_title, $subnav);
// A single item from a component other than groups.
} elseif (bp_is_single_item()) {
$title_parts = array($bp->bp_options_title, $bp->bp_options_nav[bp_current_item()][bp_current_action()]['name']);
// An index or directory.
} elseif (bp_is_directory()) {
$current_component = bp_current_component();
// No current component (when does this happen?).
$title_parts = array(_x('Directory', 'component directory title', 'buddypress'));
if (!empty($current_component)) {
$title_parts = array(bp_get_directory_title($current_component));
}
// Sign up page.
} elseif (bp_is_register_page()) {
$title_parts = array(__('Create an Account', 'buddypress'));
// Activation page.
} elseif (bp_is_activation_page()) {
$title_parts = array(__('Activate Your Account', 'buddypress'));
// Group creation page.
} elseif (bp_is_group_create()) {
$title_parts = array(__('Create a Group', 'buddypress'));
// Blog creation page.
} elseif (bp_is_create_blog()) {
$title_parts = array(__('Create a Site', 'buddypress'));
}
// Strip spans.
$title_parts = array_map('_bp_strip_spans_from_title', $title_parts);
// Sep on right, so reverse the order.
if ('right' == $seplocation) {
$title_parts = array_reverse($title_parts);
//.........这里部分代码省略.........
示例6: bp_modify_page_title
/**
* Filter the page title for BuddyPress pages.
*
* @since BuddyPress (1.5.0)
*
* @see wp_title()
* @global object $bp BuddyPress global settings.
*
* @param string $title Original page title.
* @param string $sep How to separate the various items within the page title.
* @param string $seplocation Direction to display title.
* @return string New page title.
*/
function bp_modify_page_title($title, $sep, $seplocation)
{
global $bp;
// If this is not a BP page, just return the title produced by WP
if (bp_is_blog_page()) {
return $title;
}
// If this is a 404, let WordPress handle it
if (is_404()) {
return $title;
}
// If this is the front page of the site, return WP's title
if (is_front_page() || is_home()) {
return $title;
}
$title = '';
// Displayed user
if (bp_get_displayed_user_fullname() && !is_404()) {
// Get the component's ID to try and get it's name
$component_id = $component_name = bp_current_component();
// Use the actual component name
if (!empty($bp->{$component_id}->name)) {
$component_name = $bp->{$component_id}->name;
// Fall back on the component ID (probably same as current_component)
} elseif (!empty($bp->{$component_id}->id)) {
$component_name = $bp->{$component_id}->id;
}
// Construct the page title. 1 = user name, 2 = seperator, 3 = component name
$title = strip_tags(sprintf(_x('%1$s %3$s %2$s', 'Construct the page title. 1 = user name, 2 = component name, 3 = seperator', 'buddypress'), bp_get_displayed_user_fullname(), ucwords($component_name), $sep));
// A single group
} elseif (bp_is_active('groups') && !empty($bp->groups->current_group) && !empty($bp->bp_options_nav[$bp->groups->current_group->slug])) {
$subnav = isset($bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name']) ? $bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name'] : '';
// translators: "group name | group nav section name"
$title = sprintf(__('%1$s | %2$s', 'buddypress'), $bp->bp_options_title, $subnav);
// A single item from a component other than groups
} elseif (bp_is_single_item()) {
// translators: "component item name | component nav section name | root component name"
$title = sprintf(__('%1$s | %2$s | %3$s', 'buddypress'), $bp->bp_options_title, $bp->bp_options_nav[bp_current_item()][bp_current_action()]['name'], bp_get_name_from_root_slug(bp_get_root_slug()));
// An index or directory
} elseif (bp_is_directory()) {
$current_component = bp_current_component();
// No current component (when does this happen?)
if (empty($current_component)) {
$title = _x('Directory', 'component directory title', 'buddypress');
} else {
$title = bp_get_directory_title($current_component);
}
// Sign up page
} elseif (bp_is_register_page()) {
$title = __('Create an Account', 'buddypress');
// Activation page
} elseif (bp_is_activation_page()) {
$title = __('Activate your Account', 'buddypress');
// Group creation page
} elseif (bp_is_group_create()) {
$title = __('Create a Group', 'buddypress');
// Blog creation page
} elseif (bp_is_create_blog()) {
$title = __('Create a Site', 'buddypress');
}
// Some BP nav items contain item counts. Remove them
$title = preg_replace('|<span>[0-9]+</span>|', '', $title);
return apply_filters('bp_modify_page_title', $title . ' ' . $sep . ' ', $title, $sep, $seplocation);
}
示例7: directory_dummy_post
/**
* Update the global $post with directory data
*
* @since BuddyPress (1.7)
*/
public function directory_dummy_post()
{
$title = apply_filters('bp_groups_directory_header', bp_get_directory_title('groups'));
bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => $title, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'bp_group', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
}
示例8: breadcrumbs
public static function breadcrumbs()
{
global $post;
if (is_front_page()) {
echo '<!--breadcrumbs--><nav role="navigation" class="breadcrumbs">';
echo '<ul>';
echo '<li>' . __('Home', 'socialchef') . '</li>';
echo '</ul>';
echo '</nav>';
} elseif (is_home()) {
echo '<!--breadcrumbs--><nav role="navigation" class="breadcrumbs">';
echo '<ul>';
echo '<li><a href="' . esc_url(home_url()) . '" title="' . __('Home', 'socialchef') . '">' . __('Home', 'socialchef') . '</a></li>';
echo "<li>";
echo __('Blog', 'socialchef');
echo "</li>";
echo "</ul>";
echo '</nav>';
} else {
if (defined('BP_VERSION') && (bp_current_component() == 'members' || bp_current_component() == 'groups' || bp_current_component() == 'activity' || bp_current_component() == 'profile' || bp_current_component() == 'settings' || bp_current_component() == 'notifications' || bp_current_component() == 'friends' || bp_current_component() == 'messages' || bp_current_component() == 'forums' || bp_is_register_page())) {
global $bp;
$members_root = home_url() . '/' . $bp->members->root_slug;
// slug for the Members page. The BuddyPress default is 'members'.
$activity_root = home_url() . '/' . $bp->activity->root_slug;
// slug for the Activity page. The BuddyPress default is 'activity'.
//$forums_root = $bp->forums->root_slug; // slug for the Forums page. The BuddyPress default is 'forums'.
echo '<!--breadcrumbs--><nav role="navigation" class="breadcrumbs">';
echo '<ul>';
echo '<li><a href="' . esc_url(home_url()) . '" title="' . __('Home', 'socialchef') . '">' . __('Home', 'socialchef') . '</a></li>';
if (bp_is_directory()) {
if (bp_current_component() == 'groups') {
$groups_title = bp_get_directory_title('groups');
$groups_root = home_url() . '/' . $bp->groups->root_slug;
// slug for the Groups page. The BuddyPress default is 'groups'.
echo '<li><a href="' . esc_url($groups_root) . '">' . $groups_title . '</a></li>';
} else {
echo '<li>';
echo get_the_title();
echo '</li>';
}
} else {
if ($bp->displayed_user->userdata && (bp_current_component() == 'profile' || bp_current_component() == 'messages' || bp_current_component() == 'activity' || bp_current_component() == 'notifications' || bp_current_component() == 'settings' || bp_current_component() == 'friends' || bp_current_component() == 'forums' || bp_current_component() == 'my-recipes' || bp_current_component() == 'groups')) {
$user_name = ucwords($bp->displayed_user->fullname);
// echo '<li><a href="' . esc_url( $members_root ) . '">' . get_the_title() . '</a></li>';
echo '<li><a href="' . esc_url($bp->displayed_user->domain) . '" title="' . $user_name . '">' . $user_name . '</a></li>';
echo '<li>' . ucwords($bp->current_component) . '</li>';
} else {
if (bp_is_register_page()) {
echo '<li>' . __('Register an account', 'socialchef') . '</li>';
} else {
if (bp_current_component() == 'groups') {
$groups_root = home_url() . '/' . $bp->groups->root_slug;
// slug for the Groups page. The BuddyPress default is 'groups'.
if (isset($bp->groups->current_group->name)) {
echo '<li><a href="' . esc_url($groups_root) . '">';
echo $bp->groups->current_group->name;
echo '</a></li>';
} else {
echo '<li><a href="' . esc_url($groups_root) . '">';
echo $bp->groups->name;
echo '</a></li>';
}
if (bp_current_action() == 'create') {
echo '<li>' . __('Create', 'socialchef') . '</li>';
}
}
}
}
}
echo '</ul>';
echo '</nav><!--//breadcrumbs-->';
} else {
if (class_exists('bbPress') && is_bbpress()) {
if (function_exists('bbp_breadcrumb')) {
$bbpress_bc_args = array('before' => '<nav role="navigation" class="breadcrumbs"><ul>', 'after' => '</ul></nav>', 'sep' => ' ', 'pad_sep' => 0, 'sep_before' => '', 'sep_after' => '', 'crumb_before' => '<li>', 'crumb_after' => '</li>', 'current_before' => '', 'current_after' => '');
global $sc_theme_filters;
$sc_theme_filters->disable_bbp_no_breadcrumb_filter();
bbp_breadcrumb($bbpress_bc_args);
$sc_theme_filters->enable_bbp_no_breadcrumb_filter();
}
} else {
echo '<!--breadcrumbs--><nav role="navigation" class="breadcrumbs">';
echo '<ul>';
echo '<li><a href="' . esc_url(home_url()) . '" title="' . __('Home', 'socialchef') . '">' . __('Home', 'socialchef') . '</a></li>';
if (is_category()) {
echo "<li>";
the_category('</li><li>');
echo "</li>";
} elseif (is_page() || is_single()) {
echo "<li>";
echo the_title();
echo "</li>";
} elseif (is_404()) {
echo "<li>" . __('Error 404 - Page not found', 'socialchef') . "</li>";
} elseif (is_search()) {
echo "<li>";
echo __('Search results for: ', 'socialchef');
echo '"<em>';
echo get_search_query();
echo '</em>"';
//.........这里部分代码省略.........