本文整理汇总了PHP中bp_get_groups_directory_permalink函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_groups_directory_permalink函数的具体用法?PHP bp_get_groups_directory_permalink怎么用?PHP bp_get_groups_directory_permalink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_groups_directory_permalink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: groups_directory_groups_setup
/**
* Handle the display of the Groups directory index.
*
* @since 1.0.0
*/
function groups_directory_groups_setup()
{
if (bp_is_groups_directory()) {
// Set group type if available.
if (bp_is_current_action(bp_get_groups_group_type_base()) && bp_action_variable()) {
$matched_types = bp_groups_get_group_types(array('has_directory' => true, 'directory_slug' => bp_action_variable()));
// Redirect back to group directory if no match.
if (empty($matched_types)) {
bp_core_redirect(bp_get_groups_directory_permalink());
}
// Set our global variable.
buddypress()->groups->current_directory_type = reset($matched_types);
}
bp_update_is_directory(true, 'groups');
/**
* Fires before the loading of the Groups directory index.
*
* @since 1.1.0
*/
do_action('groups_directory_groups_setup');
/**
* Filters the template to load for the Groups directory index.
*
* @since 1.0.0
*
* @param string $value Path to the groups directory index template to load.
*/
bp_core_load_template(apply_filters('groups_template_directory_groups', 'groups/index'));
}
}
示例2: cfbgr_enqueue_current_user_has_access
/**
* Restrict access to a group regarding its 'member type'
*
* If a user is not logged in, he is redirected to the login form
* If a user ! member type, he is redirected to the groups directory
* If a user is a super admin, he can access
*
* @param bool $user_has_access
* @param array &$no_access_args the redirect args
* @return bool False if member type doesn't match, true otherwise
*/
function cfbgr_enqueue_current_user_has_access($user_has_access, &$no_access_args)
{
// If the user does not already have access bail
if (empty($user_has_access)) {
return $user_has_access;
}
// Get the member type of the group
$restriction = groups_get_groupmeta(bp_get_current_group_id(), 'cf-buddypress-group-restrictions');
// Don't touch to regular groups and leave Admins access
if (empty($restriction) || bp_current_user_can('bp_moderate')) {
return $user_has_access;
}
$current_group = groups_get_current_group();
if (!is_user_logged_in()) {
$user_has_access = false;
$no_access_args = array('message' => __('You must log in to access the page you requested.', 'buddypress-group-restrictions'), 'root' => bp_get_group_permalink($current_group) . 'home/', 'redirect' => false);
return $user_has_access;
// Current user does not match the restriction
} elseif ($restriction !== bp_get_member_type(bp_loggedin_user_id())) {
$user_has_access = false;
// Get infos about the member type
$member_type_object = bp_get_member_type_object($restriction);
$singular_name = '';
if (!empty($member_type_object->labels['singular_name'])) {
$singular_name = $member_type_object->labels['singular_name'];
}
// You need to redirect to a BuddyPress page to have
$no_access_args = array('mode' => 3, 'message' => sprintf(__('Sorry the group you tried to enter is only viewable for %s members', 'buddypress-group-restrictions'), esc_html($singular_name)), 'root' => bp_get_groups_directory_permalink(), 'redirect' => false);
return $user_has_access;
}
// By default, leave BuddyPress deal with access
return $user_has_access;
}
示例3: bpg_init
function bpg_init()
{
require_once dirname(__FILE__) . '/includes/functions.php';
if (defined('BP_VERSION') && defined('WPGLOBUS_VERSION')) {
$apply_filters = false;
//TOFIX
// Always on frontend
if (!is_admin() || $apply_filters) {
$optionLanguages = wpgl_get_option_language();
$defaultLanguage = wpgl_get_default_language($optionLanguages);
$currentLanguage = wpgl_get_current_language($optionLanguages);
if ($currentLanguage != $defaultLanguage) {
apply_filters('bp_get_groups_directory_permalink', trailingslashit(bp_get_groups_directory_permalink() . $currentLanguage . '/'));
apply_filters('bp_get_activity_directory_permalink', trailingslashit(bp_get_activity_directory_permalink() . $currentLanguage . '/'));
apply_filters('bp_get_blogs_directory_permalink', trailingslashit(bp_get_blogs_directory_permalink() . $currentLanguage . '/'));
apply_filters('bp_get_forum_directory_permalink', trailingslashit(bp_get_forum_directory_permalink() . $currentLanguage . '/'));
apply_filters('bp_get_members_directory_permalink', trailingslashit(bp_get_members_directory_permalink() . $currentLanguage . '/'));
}
}
} else {
if (is_admin()) {
add_action('admin_notices', 'bpgl_admin_notice_required_plugins');
}
}
}
示例4: bp_legacy_theme_ajax_invite_user
/**
* Invites a friend to join a group via a POST request.
*
* @since BuddyPress (1.2)
* @todo Audit return types
*/
function bp_legacy_theme_ajax_invite_user()
{
// Bail if not a POST action
if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
return;
}
check_ajax_referer('groups_invite_uninvite_user');
if (!$_POST['friend_id'] || !$_POST['friend_action'] || !$_POST['group_id']) {
return;
}
if (!bp_groups_user_can_send_invites($_POST['group_id'])) {
return;
}
if (!friends_check_friendship(bp_loggedin_user_id(), $_POST['friend_id'])) {
return;
}
$group_id = (int) $_POST['group_id'];
$friend_id = (int) $_POST['friend_id'];
if ('invite' == $_POST['friend_action']) {
$group = groups_get_group($group_id);
// Users who have previously requested membership do not need
// another invitation created for them
if (BP_Groups_Member::check_for_membership_request($friend_id, $group_id)) {
$user_status = 'is_pending';
// Create the user invitation
} elseif (groups_invite_user(array('user_id' => $friend_id, 'group_id' => $group_id))) {
$user_status = 'is_invited';
// Miscellaneous failure
} else {
return;
}
$user = new BP_Core_User($friend_id);
$uninvite_url = bp_is_current_action('create') ? bp_get_groups_directory_permalink() . 'create/step/group-invites/?user_id=' . $friend_id : bp_get_group_permalink($group) . 'send-invites/remove/' . $friend_id;
echo '<li id="uid-' . esc_attr($user->id) . '">';
echo $user->avatar_thumb;
echo '<h4>' . $user->user_link . '</h4>';
echo '<span class="activity">' . esc_attr($user->last_active) . '</span>';
echo '<div class="action">
<a class="button remove" href="' . wp_nonce_url($uninvite_url, 'groups_invite_uninvite_user') . '" id="uid-' . esc_attr($user->id) . '">' . __('Remove Invite', 'buddypress') . '</a>
</div>';
if ('is_pending' == $user_status) {
echo '<p class="description">' . sprintf(__('%s has previously requested to join this group. Sending an invitation will automatically add the member to the group.', 'buddypress'), $user->user_link) . '</p>';
}
echo '</li>';
exit;
} elseif ('uninvite' == $_POST['friend_action']) {
// Users who have previously requested membership should not
// have their requests deleted on the "uninvite" action
if (BP_Groups_Member::check_for_membership_request($friend_id, $group_id)) {
return;
}
// Remove the unsent invitation
if (!groups_uninvite_user($friend_id, $group_id)) {
return;
}
exit;
} else {
return;
}
}
示例5: setup_admin_bar
/**
* Set up the component entries in the WordPress Admin Bar.
*
* @see BP_Component::setup_nav() for a description of the $wp_admin_nav
* parameter array.
*
* @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a description.
*/
public function setup_admin_bar($wp_admin_nav = array())
{
// Menus for logged in user.
if (is_user_logged_in()) {
// Setup the logged in user variables.
$groups_link = trailingslashit(bp_loggedin_user_domain() . bp_get_groups_slug());
// Pending group invites.
$count = groups_get_invite_count_for_user();
$title = _x('Groups', 'My Account Groups', 'buddypress');
$pending = _x('No Pending Invites', 'My Account Groups sub nav', 'buddypress');
if (!empty($count['total'])) {
$title = sprintf(_x('Groups <span class="count">%s</span>', 'My Account Groups nav', 'buddypress'), bp_core_number_format($count));
$pending = sprintf(_x('Pending Invites <span class="count">%s</span>', 'My Account Groups sub nav', 'buddypress'), bp_core_number_format($count));
}
// Add the "My Account" sub menus.
$wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => $title, 'href' => $groups_link);
// My Groups.
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-memberships', 'title' => _x('Memberships', 'My Account Groups sub nav', 'buddypress'), 'href' => $groups_link);
// Invitations.
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-invites', 'title' => $pending, 'href' => trailingslashit($groups_link . 'invites'));
// Create a Group.
if (bp_user_can_create_groups()) {
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-create', 'title' => _x('Create a Group', 'My Account Groups sub nav', 'buddypress'), 'href' => trailingslashit(bp_get_groups_directory_permalink() . 'create'));
}
}
parent::setup_admin_bar($wp_admin_nav);
}
示例6: widget
/**
* Extends our frontend output method.
*
* @param array $args Array of arguments for the widget.
* @param array $instance Widget instance data.
*/
public function widget($args, $instance)
{
/**
* Filters the user ID to use with the widget instance.
*
* @since 1.5.0
*
* @param string $value Empty user ID.
*/
$user_id = apply_filters('bp_group_widget_user_id', '0');
extract($args);
if (empty($instance['group_default'])) {
$instance['group_default'] = 'popular';
}
if (empty($instance['title'])) {
$instance['title'] = __('Groups', 'buddypress');
}
/**
* Filters the title of the Groups widget.
*
* @since 1.8.0
* @since 2.3.0 Added 'instance' and 'id_base' to arguments passed to filter.
*
* @param string $title The widget title.
* @param array $instance The settings for the particular instance of the widget.
* @param string $id_base Root ID for all widgets of this type.
*/
$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
/**
* Filters the separator of the group widget links.
*
* @since 2.4.0
*
* @param string $separator Separator string. Default '|'.
*/
$separator = apply_filters('bp_groups_widget_separator', '|');
echo $before_widget;
$title = !empty($instance['link_title']) ? '<a href="' . bp_get_groups_directory_permalink() . '">' . $title . '</a>' : $title;
echo $before_title . $title . $after_title;
$max_groups = !empty($instance['max_groups']) ? (int) $instance['max_groups'] : 5;
$group_args = array('user_id' => $user_id, 'type' => $instance['group_default'], 'per_page' => $max_groups, 'max' => $max_groups);
?>
<?php
if (bp_has_groups($group_args)) {
?>
<div class="item-options" id="groups-list-options">
<a href="<?php
bp_groups_directory_permalink();
?>
" id="newest-groups"<?php
if ($instance['group_default'] == 'newest') {
?>
class="selected"<?php
}
?>
><?php
_e("Newest", 'buddypress');
?>
</a>
<span class="bp-separator" role="separator"><?php
echo esc_html($separator);
?>
</span>
<a href="<?php
bp_groups_directory_permalink();
?>
" id="recently-active-groups"<?php
if ($instance['group_default'] == 'active') {
?>
class="selected"<?php
}
?>
><?php
_e("Active", 'buddypress');
?>
</a>
<span class="bp-separator" role="separator"><?php
echo esc_html($separator);
?>
</span>
<a href="<?php
bp_groups_directory_permalink();
?>
" id="popular-groups" <?php
if ($instance['group_default'] == 'popular') {
?>
class="selected"<?php
}
?>
><?php
_e("Popular", 'buddypress');
?>
</a>
//.........这里部分代码省略.........
示例7: x_buddypress_navbar_menu
function x_buddypress_navbar_menu($items, $args)
{
if (X_BUDDYPRESS_IS_ACTIVE && x_get_option('x_buddypress_header_menu_enable', '') == '1') {
$top_level_link = is_user_logged_in() ? bp_loggedin_user_domain() : bp_get_activity_directory_permalink();
$submenu_items = '';
if (bp_is_active('activity')) {
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_activity_directory_permalink() . '" class="cf"><i class="x-icon-thumbs-up" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_activity_title', __('Activity', '__x__')) . '</span></a></li>';
}
if (bp_is_active('groups')) {
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_groups_directory_permalink() . '" class="cf"><i class="x-icon-sitemap" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_groups_title', __('Groups', '__x__')) . '</span></a></li>';
}
if (is_multisite() && bp_is_active('blogs')) {
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_blogs_directory_permalink() . '" class="cf"><i class="x-icon-file" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_blogs_title', __('Blogs', '__x__')) . '</span></a></li>';
}
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_members_directory_permalink() . '" class="cf"><i class="x-icon-male" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_members_title', __('Members', '__x__')) . '</span></a></li>';
if (!is_user_logged_in()) {
if (bp_get_signup_allowed()) {
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_signup_page() . '" class="cf"><i class="x-icon-pencil" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_register_title', __('Create an Account', '__x__')) . '</span></a></li>';
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_activation_page() . '" class="cf"><i class="x-icon-key" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_activate_title', __('Activate Your Account', '__x__')) . '</span></a></li>';
}
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . wp_login_url() . '" class="cf"><i class="x-icon-sign-in" data-x-icon=""></i> <span>' . __('Log in', '__x__') . '</span></a></li>';
} else {
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_loggedin_user_domain() . '" class="cf"><i class="x-icon-cog" data-x-icon=""></i> <span>' . __('Profile', '__x__') . '</span></a></li>';
}
if ($args->theme_location == 'primary') {
$items .= '<li class="menu-item current-menu-parent menu-item-has-children x-menu-item x-menu-item-buddypress">' . '<a href="' . $top_level_link . '" class="x-btn-navbar-buddypress">' . '<span><i class="x-icon-user" data-x-icon=""></i><span class="x-hidden-desktop"> ' . __('Social', '__x__') . '</span></span>' . '</a>' . '<ul class="sub-menu">' . $submenu_items . '</ul>' . '</li>';
}
}
return $items;
}
示例8: kleo_search_form_func
function kleo_search_form_func($atts, $content = null)
{
$form_style = $type = $placeholder = $context = $el_class = '';
extract(shortcode_atts(array('form_style' => 'default', 'type' => 'both', 'context' => '', 'placeholder' => '', 'el_class' => ''), $atts));
global $kleo_config;
$class = '';
if ($el_class != '') {
$class = ' ' . $el_class;
}
$class .= ' search-style-' . $form_style;
//Defaults
$action = home_url('/');
$hidden = '';
$input_name = 's';
$ajax_results = 'yes';
$search_page = 'yes';
if ($type == 'ajax') {
$search_page = 'no';
} elseif ($type == 'form_submit') {
$ajax_results = 'no';
}
if (function_exists('bp_is_active') && $context == 'members') {
//Buddypress members form link
$action = bp_get_members_directory_permalink();
} elseif (function_exists('bp_is_active') && bp_is_active('groups') && $context == 'groups') {
//Buddypress group directory link
$action = bp_get_groups_directory_permalink();
} elseif (class_exists('bbPress') && $context == 'forum') {
$action = bbp_get_search_url();
$input_name = 'bbp_search';
} elseif ($context == 'product') {
$hidden .= '<input type="hidden" name="post_type" value="product">';
}
$output = '<div class="kleo-search-wrap kleo-search-form' . $class . '">';
$output .= '<form role="search" method="get" id="searchform" ' . ($search_page == 'no' ? ' onsubmit="return false;"' : '') . ' action="' . $action . '" data-context="' . $context . '">
<div class="input-group">
<input name="' . $input_name . '" id="' . $input_name . '" autocomplete="off" type="text" class="ajax_s form-control input-lg" value="" placeholder="' . $placeholder . '">';
if ($search_page == 'yes') {
$output .= '<span class="input-group-btn">' . '<input type="submit" value="' . __("Search") . '" id="searchsubmit" class="button">' . '</span>';
}
$output .= '</div>' . $hidden . '</form>';
if ($ajax_results == 'yes') {
$output .= '<span class="kleo-ajax-search-loading"><span class="kleo-loading-icon"></span></span><div class="kleo_ajax_results"></div>';
}
$output .= '</div>';
return $output;
}
示例9: bp_groups_admin_index
/**
* Display the Groups admin index screen.
*
* This screen contains a list of all BuddyPress groups.
*
* @since 1.7.0
*
* @global BP_Groups_List_Table $bp_groups_list_table Group screen list table.
* @global string $plugin_page Currently viewed plugin page.
*/
function bp_groups_admin_index()
{
global $bp_groups_list_table, $plugin_page;
$messages = array();
// If the user has just made a change to a group, build status messages
if (!empty($_REQUEST['deleted'])) {
$deleted = !empty($_REQUEST['deleted']) ? (int) $_REQUEST['deleted'] : 0;
if ($deleted > 0) {
$messages[] = sprintf(_n('%s group has been permanently deleted.', '%s groups have been permanently deleted.', $deleted, 'buddypress'), number_format_i18n($deleted));
}
}
// Prepare the group items for display
$bp_groups_list_table->prepare_items();
/**
* Fires before the display of messages for the edit form.
*
* Useful for plugins to modify the messages before display.
*
* @since 1.7.0
*
* @param array $messages Array of messages to be displayed.
*/
do_action('bp_groups_admin_index', $messages);
?>
<div class="wrap">
<?php
screen_icon('buddypress-groups');
?>
<h2>
<?php
_e('Groups', 'buddypress');
?>
<?php
if (is_user_logged_in() && bp_user_can_create_groups()) {
?>
<a class="add-new-h2" href="<?php
echo trailingslashit(bp_get_groups_directory_permalink() . 'create');
?>
"><?php
_e('Add New', 'buddypress');
?>
</a>
<?php
}
?>
<?php
if (!empty($_REQUEST['s'])) {
?>
<span class="subtitle"><?php
printf(__('Search results for “%s”', 'buddypress'), wp_html_excerpt(esc_html(stripslashes($_REQUEST['s'])), 50));
?>
</span>
<?php
}
?>
</h2>
<?php
// If the user has just made a change to an group, display the status messages
?>
<?php
if (!empty($messages)) {
?>
<div id="moderated" class="<?php
echo !empty($_REQUEST['error']) ? 'error' : 'updated';
?>
"><p><?php
echo implode("<br/>\n", $messages);
?>
</p></div>
<?php
}
?>
<?php
// Display each group on its own row
?>
<?php
$bp_groups_list_table->views();
?>
<form id="bp-groups-form" action="" method="get">
<?php
$bp_groups_list_table->search_box(__('Search all Groups', 'buddypress'), 'bp-groups');
?>
<input type="hidden" name="page" value="<?php
echo esc_attr($plugin_page);
//.........这里部分代码省略.........
示例10: groups_action_redirect_to_random_group
/**
* Catch requests for a random group page (example.com/groups/?random-group) and redirect.
*/
function groups_action_redirect_to_random_group()
{
if (bp_is_groups_component() && isset($_GET['random-group'])) {
$group = BP_Groups_Group::get_random(1, 1);
bp_core_redirect(trailingslashit(bp_get_groups_directory_permalink() . $group['groups'][0]->slug));
}
}
示例11: setup_admin_bar
/**
* Set up the Toolbar
*
* @global BuddyPress $bp The one true BuddyPress instance
*/
public function setup_admin_bar($wp_admin_nav = array())
{
global $bp;
// Prevent debug notices
$wp_admin_nav = array();
// Menus for logged in user
if (is_user_logged_in()) {
// Setup the logged in user variables
$user_domain = bp_loggedin_user_domain();
$groups_link = trailingslashit($user_domain . $this->slug);
// Pending group invites
$count = groups_get_invites_for_user(bp_loggedin_user_id());
$title = __('Groups', 'buddypress');
$pending = __('No Pending Invites', 'buddypress');
if (!empty($count['total'])) {
$title = sprintf(__('Groups <span class="count">%s</span>', 'buddypress'), $count['total']);
$pending = sprintf(__('Pending Invites <span class="count">%s</span>', 'buddypress'), $count['total']);
}
// Add the "My Account" sub menus
$wp_admin_nav[] = array('parent' => $bp->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => $title, 'href' => trailingslashit($groups_link));
// My Groups
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-memberships', 'title' => __('Memberships', 'buddypress'), 'href' => trailingslashit($groups_link));
// Invitations
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-invites', 'title' => $pending, 'href' => trailingslashit($groups_link . 'invites'));
// Create a Group
if (bp_user_can_create_groups()) {
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-create', 'title' => __('Create a Group', 'buddypress'), 'href' => trailingslashit(bp_get_groups_directory_permalink() . 'create'));
}
}
parent::setup_admin_bar($wp_admin_nav);
}
示例12: wp_nonce_field
</div>
<?php
wp_nonce_field('bp_forums_new_topic');
?>
</form><!-- #forum-topic-form -->
<?php
} elseif (bp_is_active('groups')) {
?>
<div id="message" class="info">
<p><?php
printf(__("You are not a member of any groups so you don't have any group forums you can post in. To start posting, first find a group that matches the topic subject you'd like to start. If this group does not exist, why not <a href='%s'>create a new group</a>? Once you have joined or created the group you can post your topic in that group's forum.", 'buddypress'), trailingslashit(bp_get_groups_directory_permalink() . 'create'));
?>
</p>
</div>
<?php
}
?>
<?php
}
?>
</div><!-- #new-topic-post -->
<?php
示例13: x_breadcrumbs
function x_breadcrumbs()
{
if (x_get_option('x_breadcrumb_display')) {
global $post;
$is_ltr = !is_rtl();
$stack = x_get_stack();
$delimiter = x_get_breadcrumb_delimiter();
$home_text = x_get_breadcrumb_home_text();
$home_link = home_url();
$current_before = x_get_breadcrumb_current_before();
$current_after = x_get_breadcrumb_current_after();
$page_title = get_the_title();
$blog_title = get_the_title(get_option('page_for_posts', true));
if (!is_404()) {
$post_parent = $post->post_parent;
} else {
$post_parent = '';
}
if (X_WOOCOMMERCE_IS_ACTIVE) {
$shop_url = x_get_shop_link();
$shop_title = x_get_option('x_' . $stack . '_shop_title');
$shop_link = '<a href="' . $shop_url . '">' . $shop_title . '</a>';
}
echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter;
if (is_home()) {
echo $current_before . $blog_title . $current_after;
} elseif (is_category()) {
$the_cat = get_category(get_query_var('cat'), false);
if ($the_cat->parent != 0) {
echo get_category_parents($the_cat->parent, TRUE, $delimiter);
}
echo $current_before . single_cat_title('', false) . $current_after;
} elseif (x_is_product_category()) {
if ($is_ltr) {
echo $shop_link . $delimiter . $current_before . single_cat_title('', false) . $current_after;
} else {
echo $current_before . single_cat_title('', false) . $current_after . $delimiter . $shop_link;
}
} elseif (x_is_product_tag()) {
if ($is_ltr) {
echo $shop_link . $delimiter . $current_before . single_tag_title('', false) . $current_after;
} else {
echo $current_before . single_tag_title('', false) . $current_after . $delimiter . $shop_link;
}
} elseif (is_search()) {
echo $current_before . __('Search Results for ', '__x__') . '“' . get_search_query() . '”' . $current_after;
} elseif (is_singular('post')) {
if (get_option('page_for_posts') == is_front_page()) {
echo $current_before . $page_title . $current_after;
} else {
if ($is_ltr) {
echo '<a href="' . get_permalink(get_option('page_for_posts')) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
} else {
echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . get_permalink(get_option('page_for_posts')) . '">' . $blog_title . '</a>';
}
}
} elseif (x_is_portfolio()) {
echo $current_before . get_the_title() . $current_after;
} elseif (x_is_portfolio_item()) {
$link = x_get_parent_portfolio_link();
$title = x_get_parent_portfolio_title();
if ($is_ltr) {
echo '<a href="' . $link . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
} else {
echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . $link . '">' . $title . '</a>';
}
} elseif (x_is_product()) {
if ($is_ltr) {
echo $shop_link . $delimiter . $current_before . $page_title . $current_after;
} else {
echo $current_before . $page_title . $current_after . $delimiter . $shop_link;
}
} elseif (x_is_buddypress()) {
if (bp_is_group()) {
echo '<a href="' . bp_get_groups_directory_permalink() . '">' . x_get_option('x_buddypress_groups_title') . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after;
} elseif (bp_is_user()) {
echo '<a href="' . bp_get_members_directory_permalink() . '">' . x_get_option('x_buddypress_members_title') . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after;
} else {
echo $current_before . x_buddypress_get_the_title() . $current_after;
}
} elseif (x_is_bbpress()) {
remove_filter('bbp_no_breadcrumb', '__return_true');
if (bbp_is_forum_archive()) {
echo $current_before . bbp_get_forum_archive_title() . $current_after;
} else {
echo bbp_get_breadcrumb();
}
add_filter('bbp_no_breadcrumb', '__return_true');
} elseif (is_page() && !$post_parent) {
echo $current_before . $page_title . $current_after;
} elseif (is_page() && $post_parent) {
$parent_id = $post_parent;
$breadcrumbs = array();
if (is_rtl()) {
echo $current_before . $page_title . $current_after . $delimiter;
}
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
$parent_id = $page->post_parent;
//.........这里部分代码省略.........
示例14: group_ideas_archive_url
/**
* Builds a link to the Group's ideas archive page
*
* @package WP Idea Stream
* @subpackage buddypress/groups
*
* @since 2.0.0
*
* @param BP_Groups_Group $group a group object
* @param bool $fallback whether to use a fallback url
* @uses groups_get_current_group() to test if a current group is set
* @uses bp_get_groups_directory_permalink() to get the Groups directory permalink
* @uses bp_get_group_permalink() to build the link to group's home
* @uses WP_Idea_Stream_Group::group_get_option() to check for the group setting
* @uses wp_idea_stream_root_slug() to get IdeaStream root slug
* @return string permalink to the group's main idea page
*/
public function group_ideas_archive_url($group = null, $fallback = false)
{
// Try to get current
if (empty($group)) {
$group = groups_get_current_group();
}
if (empty($group->slug)) {
$group_url = false;
// return the groups directory if slug is not set and
// fallback is requested
if (!empty($fallback)) {
$group_url = bp_get_groups_directory_permalink();
}
return $group_url;
}
$group_url = bp_get_group_permalink($group);
// return the group home url if IdeaStream is not active for this group
if (!self::group_get_option($group->id, '_group_ideastream_activate', false)) {
return $group_url;
}
// Return the group's IdeaStream Archive url.
return trailingslashit($group_url . wp_idea_stream_root_slug());
}
示例15: get_context
/**
* Get the page context
* @version 2.0
*/
function get_context()
{
// Setup placeholders
$title = SITENAME;
$desc = get_bloginfo('description');
$classes = get_body_class();
$crumbs = array();
// Get some data
$id = $this->queried_object_id;
$object = $this->queried_object;
$sep = " • ";
/*--------------------------------------------
DEFAULT CONTEXT
---------------------------------------------*/
$classes[] = 0 == get_current_user_id() ? 'logged-out' : 'logged-in';
$crumbs[] = '<a href="' . SITEURL . '" title="' . SITENAME . '" rel="home" class="trail-home">Home</a>';
// Homepage
if (is_home()) {
$title = SITENAME . $sep . 'Home';
$classes[] = 'home';
$classes[] = 'sidebar';
$classes[] = 'archive';
/*--------------------------------------------
BUDDYPRESS CONTEXT
---------------------------------------------*/
} elseif (class_exists('BuddyPress') && is_buddypress()) {
// BuddyPress Defaults
$title = "BuddyPress Page";
$desc = "This is a BuddyPress page.";
$classes[] = 'buddypress';
// User Profiles
if (bp_is_user()) {
$title = bp_get_displayed_user_fullname() . $sep . "User Profile";
$desc = SITENAME . " user profile for member " . bp_get_displayed_user_fullname();
// Your own profile
if (bp_is_my_profile()) {
$crumbs[] = 'Your Profile';
} else {
$crumbs[] = '<a href="' . bp_get_members_directory_permalink() . '" title="Members Directory">Members</a>';
$crumbs[] = '<a href="' . bp_displayed_user_domain() . '" title="' . bp_get_displayed_user_fullname() . '">' . bp_get_displayed_user_fullname() . '</a>';
}
// Display the profile component if it isnt the profile home
if (!bp_is_user_profile()) {
$crumbs[] = ucfirst(bp_current_component());
}
// Display the current action if it is not the default public profile
if (!in_array(bp_current_action(), array('public', 'just-me', 'my-friends'))) {
$crumbs[] = ucfirst(bp_current_action());
}
// Single Group
} elseif (bp_is_group() || bp_is_group_create()) {
// Group Creation
if (bp_is_group_create()) {
$title = 'Submit New Group';
$desc = 'Submit a new user group for listing on the ' . SITENAME . ' community groups directory.';
$crumbs[] = '<a href="' . SITEURL . '/' . bp_get_groups_root_slug() . '" title="Groups Directory">Groups</a>';
$crumbs[] = 'Create Group';
} elseif (bp_is_group()) {
// Default entries
$title = bp_get_group_name();
$desc = SITENAME . ' guild profile for ' . bp_get_group_name();
$classes = array_diff($classes, array('page', 'page-template-default'));
$crumbs[] = '<a href="' . bp_get_groups_directory_permalink() . '" title="Groups Directory">Groups</a>';
// Group Profile Home
if (bp_is_group_home()) {
$title = $title . $sep . 'Profile';
$crumbs[] = bp_get_group_name();
// Advanced Component
} else {
// Link back to group profile
$crumbs[] = '<a href="' . bp_get_group_permalink() . '" title="Return to Group Profile">' . bp_get_group_name() . '</a>';
// Members
if (bp_is_group_members()) {
$title = $title . $sep . 'Members';
$crumbs[] = 'Members';
// Activity
} elseif (bp_is_group_activity()) {
$title = $title . $sep . 'Activity';
$crumbs[] = 'Activity';
// Invites
} elseif (bp_is_group_invites()) {
$title = $title . $sep . 'Invitations';
$crumbs[] = 'Invitations';
// Admin
} elseif (bp_is_group_admin_page()) {
$title = $title . $sep . 'Admin';
$crumbs[] = 'Admin';
// Forum
} else {
// Forum Root
if (NULL == bp_action_variable()) {
$title = $title . $sep . 'Forum';
$crumbs[] = 'Forum';
// Sub-Component
} else {
$crumbs[] = '<a href="' . bp_get_group_permalink() . 'forum/" title="Group Forum">Forum</a>';
//.........这里部分代码省略.........