本文整理汇总了PHP中bp_current_item函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_current_item函数的具体用法?PHP bp_current_item怎么用?PHP bp_current_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_current_item函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_group
/**
* Are we looking at something that needs group theme compatibility?
*
* @since 1.7.0
*/
public function is_group()
{
// Bail if not looking at a group.
if (!bp_is_groups_component()) {
return;
}
// Group Directory.
if (!bp_current_action() && !bp_current_item()) {
bp_update_is_directory(true, 'groups');
/**
* Fires at the start of the group theme compatibility setup.
*
* @since 1.1.0
*/
do_action('groups_directory_groups_setup');
add_filter('bp_get_buddypress_template', array($this, 'directory_template_hierarchy'));
add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post'));
add_filter('bp_replace_the_content', array($this, 'directory_content'));
// Creating a group.
} elseif (bp_is_groups_component() && bp_is_current_action('create')) {
add_filter('bp_get_buddypress_template', array($this, 'create_template_hierarchy'));
add_action('bp_template_include_reset_dummy_post_data', array($this, 'create_dummy_post'));
add_filter('bp_replace_the_content', array($this, 'create_content'));
// Group page.
} elseif (bp_is_single_item()) {
add_filter('bp_get_buddypress_template', array($this, 'single_template_hierarchy'));
add_action('bp_template_include_reset_dummy_post_data', array($this, 'single_dummy_post'));
add_filter('bp_replace_the_content', array($this, 'single_content'));
}
}
示例2: bp_portfolio_directory_setup
/**
* Load the index page
*/
function bp_portfolio_directory_setup()
{
if (bp_is_portfolio_component() && !bp_current_action() && !bp_current_item()) {
bp_update_is_directory(true, 'portfolio');
do_action('bp_portfolio_directory_setup');
bp_core_load_template(apply_filters('portfolio_directory_template', BP_PORTFOLIO_TEMPLATE . '/index'));
}
}
示例3: groups_directory_groups_setup
function groups_directory_groups_setup()
{
if (bp_is_groups_component() && !bp_current_action() && !bp_current_item()) {
bp_update_is_directory(true, 'groups');
do_action('groups_directory_groups_setup');
bp_core_load_template(apply_filters('groups_template_directory_groups', 'groups/index'));
}
}
示例4: bp_forums_directory_forums_setup
function bp_forums_directory_forums_setup()
{
global $bp;
if (bp_is_forums_component() && (!bp_current_action() || 'tag' == bp_current_action() && bp_action_variables()) && !bp_current_item()) {
if (!bp_forums_has_directory()) {
return false;
}
if (!bp_forums_is_installed_correctly()) {
bp_core_add_message(__('The forums component has not been set up yet.', 'buddypress'), 'error');
bp_core_redirect(bp_get_root_domain());
}
bp_update_is_directory(true, 'forums');
do_action('bbpress_init');
// Check to see if the user has posted a new topic from the forums page.
if (isset($_POST['submit_topic']) && bp_is_active('forums')) {
check_admin_referer('bp_forums_new_topic');
$bp->groups->current_group = groups_get_group(array('group_id' => $_POST['topic_group_id']));
if (!empty($bp->groups->current_group->id)) {
// Auto join this user if they are not yet a member of this group
if (!is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member($bp->loggedin_user->id, $bp->groups->current_group->id)) {
groups_join_group($bp->groups->current_group->id);
}
$error_message = '';
$forum_id = groups_get_groupmeta($bp->groups->current_group->id, 'forum_id');
if (!empty($forum_id)) {
if (empty($_POST['topic_title'])) {
$error_message = __('Please provide a title for your forum topic.', 'buddypress');
} else {
if (empty($_POST['topic_text'])) {
$error_message = __('Forum posts cannot be empty. Please enter some text.', 'buddypress');
}
}
if ($error_message) {
bp_core_add_message($error_message, 'error');
$redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum';
} else {
if (!($topic = groups_new_group_forum_topic($_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id))) {
bp_core_add_message(__('There was an error when creating the topic', 'buddypress'), 'error');
$redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum';
} else {
bp_core_add_message(__('The topic was created successfully', 'buddypress'));
$redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum/topic/' . $topic->topic_slug . '/';
}
}
bp_core_redirect($redirect);
} else {
bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error');
bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink()));
}
} else {
bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error');
bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink()));
}
}
do_action('bp_forums_directory_forums_setup');
bp_core_load_template(apply_filters('bp_forums_template_directory_forums_setup', 'forums/index'));
}
}
示例5: bp_course_directory_setup
/**
* If your component uses a top-level directory, this function will catch the requests and load
* the index page.
*
* @package BuddyPress_Template_Pack
* @since 1.6
*/
function bp_course_directory_setup()
{
if (bp_is_course_component() && !bp_current_action() && !bp_current_item()) {
// This wrapper function sets the $bp->is_directory flag to true, which help other
// content to display content properly on your directory.
bp_update_is_directory(true, BP_COURSE_SLUG);
// Add an action so that plugins can add content or modify behavior
do_action('bp_course_directory_setup');
bp_core_load_template(apply_filters('course_directory_template', 'course/index'));
}
}
示例6: breadcrumb_bp_current_item
function breadcrumb_bp_current_item($item)
{
$params = array('bp_component' => bp_current_component(), 'bp_item' => bp_current_item(), 'bp_action' => bp_current_action(), 'bp_action_variables' => bp_action_variables());
switch (bp_current_component()) {
case false:
return $item;
break;
case 'groups':
return new Breadcrumb_BP_Component_Group($item, $params);
break;
default:
return new Breadcrumb_BP_Component($item, $params);
}
}
示例7: is_members
/**
* Are we looking at something that needs members theme compatibility?
*
* @since 1.7.0
*/
public function is_members()
{
// Bail if not looking at the members component or a user's page.
if (!bp_is_members_component() && !bp_is_user()) {
return;
}
// Members Directory.
if (!bp_current_action() && !bp_current_item()) {
bp_update_is_directory(true, 'members');
/**
* Fires if looking at Members directory when needing theme compat.
*
* @since 1.5.0
*/
do_action('bp_members_screen_index');
add_filter('bp_get_buddypress_template', array($this, 'directory_template_hierarchy'));
add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post'));
add_filter('bp_replace_the_content', array($this, 'directory_content'));
// User page.
} elseif (bp_is_user()) {
// If we're on a single activity permalink page, we shouldn't use the members
// template, so stop here!
if (bp_is_active('activity') && bp_is_single_activity()) {
return;
}
/**
* Fires if looking at Members user page when needing theme compat.
*
* @since 1.5.0
*/
do_action('bp_members_screen_display_profile');
add_filter('bp_get_buddypress_template', array($this, 'single_template_hierarchy'));
add_action('bp_template_include_reset_dummy_post_data', array($this, 'single_dummy_post'));
add_filter('bp_replace_the_content', array($this, 'single_dummy_content'));
}
}
示例8: bp_get_forum_permalink
/**
* Return the permalink to a given forum.
*
* @param int $forum_id Optional. Defaults to the current forum, if
* there is one.
* @return string|bool False on failure, a URL on success.
*/
function bp_get_forum_permalink( $forum_id = 0 ) {
global $bp;
if ( bp_is_groups_component() ) {
$permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_current_item() . '/forum' );
} else {
if ( empty( $forum_id ) ) {
global $topic_template;
if ( isset( $topic_template->forum_id ) )
$forum_id = $topic_template->forum_id;
}
if ( $forum = bp_forums_get_forum( $forum_id ) )
$permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/forum/' . $forum->forum_slug );
else
return false;
}
/**
* Filters the permalink to a given forum.
*
* @since BuddyPress (1.0.0)
*
* @param string $value Peramlink to the given forum.
*/
return apply_filters( 'bp_get_forum_permalink', trailingslashit( $permalink ) );
}
示例9: bp_is_current_item
function bp_is_current_item($item = '')
{
if (!empty($item) && $item == bp_current_item()) {
return true;
}
return false;
}
示例10: meso_schema_breadcrumbs
//.........这里部分代码省略.........
echo $taxlist;
}
}
echo ' ' . $delimiter . ' ' . __('You are reading »', 'mesocolumn');
} else {
$category = get_the_category();
if ($category) {
foreach ($category as $cat) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_category_link($cat->term_id) . '">' . '<span' . $schema_prop_title . '>' . $cat->name . '</span>' . '</a></span>' . $delimiter . ' ';
}
}
echo __('You are reading »', 'mesocolumn');
}
} elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404()) {
$post_type = get_post_type_object(get_post_type());
echo $before . $post_type->labels->singular_name . $after;
} elseif (is_attachment()) {
$parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID);
$cat = $cat[0];
if ($cat) {
echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
}
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink($parent) . '">' . '<span' . $schema_prop_title . '>' . $parent->post_title . '</span>' . '</a></span>';
if ($showCurrent == 1) {
echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after;
}
} elseif (is_page() && !$post->post_parent) {
if (class_exists('buddypress')) {
global $bp;
if (bp_is_groups_component()) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('groups') . '</span>' . '</a></span>';
if (!bp_is_directory()) {
echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '/' . bp_current_item() . '">' . '<span' . $schema_prop_title . '>' . bp_current_item() . '</span>' . '</a></span>';
if (bp_current_action()) {
echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '/' . bp_current_item() . '/' . bp_current_action() . '">' . '<span' . $schema_prop_title . '>' . bp_current_action() . '</span>' . '</a></span>';
}
}
} else {
if (bp_is_members_directory()) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('members') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('members') . '</span>' . '</a></span>';
} else {
if (bp_is_user()) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('members') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('members') . '</span>' . '</a></span>';
echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . bp_core_get_user_domain($bp->displayed_user->id) . '">' . '<span' . $schema_prop_title . '>' . bp_get_displayed_user_username() . '</span>' . '</a></span>';
if (bp_current_action()) {
echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . bp_core_get_user_domain($bp->displayed_user->id) . bp_current_component() . '">' . '<span' . $schema_prop_title . '>' . bp_current_component() . '</span>' . '</a></span>';
}
} else {
if (bp_is_directory()) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . bp_current_component() . '</span>' . '</a></span>';
} else {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . the_title_attribute('echo=0') . '</span>' . '</a></span>';
}
}
}
}
} else {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . the_title_attribute('echo=0') . '</span>' . '</a></span>';
}
} elseif (is_page() && $post->post_parent) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink($page->ID) . '">' . '<span' . $schema_prop_title . '>' . get_the_title($page->ID) . '</span>' . '</a></span>';
示例11: 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 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();
//.........这里部分代码省略.........
示例12: bp_modify_page_title
/**
* Filter the page title for BuddyPress pages
*
* @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
* @see wp_title()
* @since BuddyPress (1.5)
*/
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 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;
}
// translators: "displayed user's name | canonicalised component name"
$title = strip_tags(sprintf(__('%1$s | %2$s', 'buddypress'), bp_get_displayed_user_fullname(), ucwords($component_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'] : '';
// 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()) {
if (!bp_current_component()) {
$title = sprintf(__('%s Directory', 'buddypress'), bp_get_name_from_root_slug());
} else {
$title = sprintf(__('%s Directory', 'buddypress'), bp_get_name_from_root_slug());
}
// 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);
}
示例13: 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);
//.........这里部分代码省略.........
示例14: maybe_set_ideastream
//.........这里部分代码省略.........
}
break;
// Viewing a single idea
// Viewing a single idea
case wp_idea_stream_idea_get_slug():
// No name, stop
if (empty($actions[1])) {
$message = __('No idea was requested', 'wp-idea-stream');
break;
}
// Get the idea thanks to its name
$idea = wp_idea_stream_ideas_get_idea_by_name($actions[1]);
if ($this->is_idea_attached_to_group($idea)) {
$this->group_ideastream->is_action = 'idea';
$this->group_ideastream->idea_name = $actions[1];
// Set the query loop
$query_loop = new StdClass();
$query_loop->idea = $idea;
wp_idea_stream_set_idea_var('query_loop', $query_loop);
wp_idea_stream_set_idea_var('single_idea_id', $idea->ID);
} else {
$message = __('The idea was not found in this group.', 'wp-idea-stream');
}
break;
case wp_idea_stream_tag_get_slug():
case wp_idea_stream_category_get_slug():
// No term name, stop
if (empty($actions[1])) {
$message = sprintf(__('No %s was requested', 'wp-idea-stream'), $actions[0]);
break;
}
// Does the group support categories ?
if ($actions[0] == wp_idea_stream_category_get_slug() && !self::group_get_option(bp_get_current_group_id(), '_group_ideastream_categories', true)) {
$message = sprintf(__('This group does not support the %s feature.', 'wp-idea-stream'), $actions[0]);
break;
}
// Using tag as default, as category can be disabled from group settings.
if ($actions[0] == wp_idea_stream_tag_get_slug()) {
$this->group_ideastream->current_taxonomy = wp_idea_stream_get_tag();
// Set tag as a query var.
set_query_var(wp_idea_stream_get_tag(), $actions[1]);
} else {
if ($actions[0] == wp_idea_stream_category_get_slug()) {
$this->group_ideastream->current_taxonomy = wp_idea_stream_get_category();
// Set category as a query var.
set_query_var(wp_idea_stream_get_category(), $actions[1]);
}
}
// Try to get the term with its slug
$this->group_ideastream->current_term = get_term_by('slug', $actions[1], $this->group_ideastream->current_taxonomy);
if (!empty($this->group_ideastream->current_term)) {
$this->group_ideastream->is_action = $actions[0];
$this->group_ideastream->context = 'taxonomy';
// Set the current term
wp_idea_stream_set_idea_var('current_term', $this->group_ideastream->current_term);
} else {
$message = sprintf(__('The %s was not found', 'wp-idea-stream'), $actions[0]);
break;
}
break;
default:
$this->group_ideastream->is_action = 'archive';
$this->group_ideastream->context = 'archive';
break;
}
// Set pagination for taxonomy & archive page
if (!empty($this->group_ideastream->context) && in_array($this->group_ideastream->context, array('taxonomy', 'archive'))) {
$possible_page_number = array($actions[0]);
if (!empty($actions[2])) {
$possible_page_number = array_merge($possible_page_number, array($actions[2]));
}
if (in_array(wp_idea_stream_paged_slug(), $possible_page_number)) {
if (is_numeric($actions[1])) {
$this->group_ideastream->is_paged = absint($actions[1]);
} else {
if (is_numeric($actions[3])) {
$this->group_ideastream->is_paged = absint($actions[3]);
} else {
$this->group_ideastream->is_paged = 0;
}
}
}
}
if (!empty($message)) {
wp_idea_stream_add_message(array('type' => 'error', 'content' => $message));
bp_core_redirect($this->group_ideas_archive_url(groups_get_current_group(), true));
}
/**
* Redirect to a 404 if needed
*
* It's the case when trying to see an idea attached to an hidden group while the user
* is not a member of this group.
*/
} else {
if (bp_is_current_component('groups') && bp_is_current_action(wp_idea_stream_root_slug()) && bp_current_item()) {
bp_do_404();
return;
}
}
}
示例15: array
</li>
</ul>
</div>
</div>
<div class="header-bottom">
<nav id="sub-navigation" class="site-navigation sub-navigation">
<?php
if (bp_current_item()) {
?>
<?php
$args = array('name' => bp_current_item(), 'post_type' => 'page', 'post_status' => 'publish', 'numberposts' => 1);
$page = get_posts($args);
if ($page[0]->ID) {
$pageID = $page[0]->ID;
$args = array('post_parent' => $page[0]->ID, 'post_type' => 'page', 'posts_per_page' => -1, 'post_status' => 'publish');
$subpages = get_children($args);
echo '<ul class="menu">';
$listItems = '';
$oneActive = false;
foreach ($subpages as $page) {
if ($page->ID == get_the_ID()) {
$class = 'active';
$oneActive = true;
} else {
$class = '';
}