当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_get_blogs_slug函数代码示例

本文整理汇总了PHP中bp_get_blogs_slug函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_blogs_slug函数的具体用法?PHP bp_get_blogs_slug怎么用?PHP bp_get_blogs_slug使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_get_blogs_slug函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bp_adminbar_blogs_menu

/**
 * Add a Sites menu to the BuddyBar.
 *
 * @since BuddyPress (1.0.0)
 * @deprecated BuddyPress (2.1.0)
 *
 * @global object $bp The BuddyPress global settings object.
 *
 * @return bool|null Returns false on failure. Otherwise echoes the menu item.
 */
function bp_adminbar_blogs_menu()
{
    global $bp;
    if (!is_user_logged_in() || !bp_is_active('blogs')) {
        return false;
    }
    if (!is_multisite()) {
        return false;
    }
    $blogs = wp_cache_get('bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', 'bp');
    if (empty($blogs)) {
        $blogs = bp_blogs_get_blogs_for_user(bp_loggedin_user_id(), true);
        wp_cache_set('bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', $blogs, 'bp');
    }
    $counter = 0;
    if (is_array($blogs['blogs']) && (int) $blogs['count']) {
        echo '<li id="bp-adminbar-blogs-menu"><a href="' . trailingslashit(bp_loggedin_user_domain() . bp_get_blogs_slug()) . '">';
        _e('My Sites', 'buddypress');
        echo '</a>';
        echo '<ul>';
        foreach ((array) $blogs['blogs'] as $blog) {
            $alt = 0 == $counter % 2 ? ' class="alt"' : '';
            $site_url = esc_attr($blog->siteurl);
            echo '<li' . $alt . '>';
            echo '<a href="' . $site_url . '">' . esc_html($blog->name) . '</a>';
            echo '<ul>';
            echo '<li class="alt"><a href="' . $site_url . 'wp-admin/">' . __('Dashboard', 'buddypress') . '</a></li>';
            echo '<li><a href="' . $site_url . 'wp-admin/post-new.php">' . __('New Post', 'buddypress') . '</a></li>';
            echo '<li class="alt"><a href="' . $site_url . 'wp-admin/edit.php">' . __('Manage Posts', 'buddypress') . '</a></li>';
            echo '<li><a href="' . $site_url . 'wp-admin/edit-comments.php">' . __('Manage Comments', 'buddypress') . '</a></li>';
            echo '</ul>';
            do_action('bp_adminbar_blog_items', $blog);
            echo '</li>';
            $counter++;
        }
        $alt = 0 == $counter % 2 ? ' class="alt"' : '';
        if (bp_blog_signup_enabled()) {
            echo '<li' . $alt . '>';
            echo '<a href="' . bp_get_root_domain() . '/' . bp_get_blogs_root_slug() . '/create/">' . __('Create a Site!', 'buddypress') . '</a>';
            echo '</li>';
        }
        echo '</ul>';
        echo '</li>';
    }
}
开发者ID:eresyyl,项目名称:mk,代码行数:55,代码来源:2.1.php

示例2: setup_nav

 /**
  * Setup BuddyBar navigation
  *
  * @global obj $bp
  */
 function setup_nav()
 {
     global $bp;
     /**
      * Blog/post/comment menus should not appear on single WordPress setups.
      * Although comments and posts made by users will still show on their
      * activity stream.
      */
     if (!is_multisite()) {
         return false;
     }
     // Add 'Sites' to the main navigation
     $main_nav = array('name' => sprintf(__('Sites <span>%d</span>', 'buddypress'), bp_blogs_total_blogs_for_user()), 'slug' => $this->slug, 'position' => 30, 'screen_function' => 'bp_blogs_screen_my_blogs', 'default_subnav_slug' => 'my-sites', 'item_css_id' => $this->id);
     $parent_url = trailingslashit(bp_displayed_user_domain() . bp_get_blogs_slug());
     $sub_nav[] = array('name' => __('My Sites', 'buddypress'), 'slug' => 'my-sites', 'parent_url' => $parent_url, 'parent_slug' => $bp->blogs->slug, 'screen_function' => 'bp_blogs_screen_my_blogs', 'position' => 10);
     // Setup navigation
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:newington,项目名称:buddypress,代码行数:23,代码来源:bp-blogs-loader.php

示例3: bp_root_domain

bp_root_domain();
?>
/<?php 
bp_blogs_root_slug();
?>
"><?php 
printf(__('All Sites <span>%s</span>', 'buddypress'), bp_get_total_blog_count());
?>
</a></li>

					<?php 
if (is_user_logged_in() && bp_get_total_blog_count_for_user(bp_loggedin_user_id())) {
    ?>

						<li id="blogs-personal"><a href="<?php 
    echo bp_loggedin_user_domain() . bp_get_blogs_slug();
    ?>
"><?php 
    printf(__('My Sites <span>%s</span>', 'buddypress'), bp_get_total_blog_count_for_user(bp_loggedin_user_id()));
    ?>
</a></li>

					<?php 
}
?>

					<?php 
do_action('bp_blogs_directory_blog_types');
?>

				</ul>
开发者ID:nxtclass,项目名称:NXTClass-themes,代码行数:31,代码来源:index.php

示例4: action_handler

 /**
  * Action handler when a follow blogs button is clicked.
  *
  * Handles both following and unfollowing a blog.
  */
 public static function action_handler()
 {
     if (empty($_GET['blog_id']) || !is_user_logged_in()) {
         return;
     }
     $action = false;
     if (!empty($_GET['bpfb-follow']) || !empty($_GET['bpfb-unfollow'])) {
         $nonce = !empty($_GET['bpfb-follow']) ? $_GET['bpfb-follow'] : $_GET['bpfb-unfollow'];
         $action = !empty($_GET['bpfb-follow']) ? 'follow' : 'unfollow';
         $save = !empty($_GET['bpfb-follow']) ? 'bp_follow_start_following' : 'bp_follow_stop_following';
     }
     if (!$action) {
         return;
     }
     if (!wp_verify_nonce($nonce, "bp_follow_blog_{$action}")) {
         return;
     }
     if (!$save(array('leader_id' => (int) $_GET['blog_id'], 'follower_id' => bp_loggedin_user_id(), 'follow_type' => 'blogs'))) {
         if ('follow' == $action) {
             $message = __('You are already following that blog.', 'bp-follow');
         } else {
             $message = __('You are not following that blog.', 'bp-follow');
         }
         bp_core_add_message($message, 'error');
         // success on follow action
     } else {
         $blog_name = bp_blogs_get_blogmeta((int) $_GET['blog_id'], 'name');
         // blog has never been recorded into BP; record it now
         if ('' === $blog_name && apply_filters('bp_follow_blogs_record_blog', true, (int) $_GET['blog_id'])) {
             // get the admin of the blog
             $admin = get_users(array('blog_id' => get_current_blog_id(), 'role' => 'administrator', 'orderby' => 'ID', 'number' => 1, 'fields' => array('ID')));
             // record the blog
             $record_site = bp_blogs_record_blog((int) $_GET['blog_id'], $admin[0]->ID, true);
             // now refetch the blog name from blogmeta
             if (false !== $record_site) {
                 $blog_name = bp_blogs_get_blogmeta((int) $_GET['blog_id'], 'name');
             }
         }
         if ('follow' == $action) {
             if (!empty($blog_name)) {
                 $message = sprintf(__('You are now following the site, %s.', 'bp-follow'), $blog_name);
             } else {
                 $message = __('You are now following that site.', 'bp-follow');
             }
         } else {
             if (!empty($blog_name)) {
                 $message = sprintf(__('You are no longer following the site, %s.', 'bp-follow'), $blog_name);
             } else {
                 $message = __('You are no longer following that site.', 'bp-follow');
             }
         }
         bp_core_add_message($message);
     }
     // it's possible that wp_get_referer() returns false, so let's fallback to the displayed user's page
     $redirect = wp_get_referer() ? wp_get_referer() : bp_displayed_user_domain() . bp_get_blogs_slug() . '/' . constant('BP_FOLLOW_BLOGS_USER_FOLLOWING_SLUG') . '/';
     bp_core_redirect($redirect);
 }
开发者ID:vikramshaw,项目名称:buddypress-followers,代码行数:62,代码来源:blogs.php

示例5: max

$max_pages = max(ceil($blogs_template->total_blog_count / 14), 1);
?>

			<h3><?php 
_e('Site Directory', 'huddle');
?>
</h3>
			<p class="subtitle">
				<?php 
bp_blogs_pagination_count();
?>
				<?php 
if (is_user_logged_in() && bp_blog_signup_enabled()) {
    ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="btn-gray quick-create-blog" href="<?php 
    echo add_query_arg('w-iframe', '1', bp_get_root_domain() . '/' . bp_get_blogs_slug() . '/create/');
    ?>
"><?php 
    _e('Create a Blog', 'huddle');
    ?>
</a><?php 
}
?>
			</p>

			<?php 
do_action('bp_before_directory_blogs_content');
?>

			<div id="blog-dir-search" class="dir-search" role="search">
开发者ID:nxtclass,项目名称:NXTClass-themes,代码行数:30,代码来源:index.php

示例6: bp_blogs_blog_tabs

/**
 * Output navigation tabs for a user Blogs page.
 *
 * Currently unused by BuddyPress.
 */
function bp_blogs_blog_tabs()
{
    // Don't show these tabs on a user's own profile
    if (bp_is_my_profile()) {
        return false;
    }
    ?>

	<ul class="content-header-nav">
		<li<?php 
    if (bp_is_current_action('my-blogs') || !bp_current_action()) {
        ?>
 class="current"<?php 
    }
    ?>
><a href="<?php 
    echo trailingslashit(bp_displayed_user_domain() . bp_get_blogs_slug() . '/my-blogs');
    ?>
"><?php 
    printf(__("%s's Sites", 'buddypress'), bp_get_displayed_user_fullname());
    ?>
</a></li>
		<li<?php 
    if (bp_is_current_action('recent-posts')) {
        ?>
 class="current"<?php 
    }
    ?>
><a href="<?php 
    echo trailingslashit(bp_displayed_user_domain() . bp_get_blogs_slug() . '/recent-posts');
    ?>
"><?php 
    printf(__("%s's Recent Posts", 'buddypress'), bp_get_displayed_user_fullname());
    ?>
</a></li>
		<li<?php 
    if (bp_is_current_action('recent-comments')) {
        ?>
 class="current"<?php 
    }
    ?>
><a href="<?php 
    echo trailingslashit(bp_displayed_user_domain() . bp_get_blogs_slug() . '/recent-comments');
    ?>
"><?php 
    printf(__("%s's Recent Comments", 'buddypress'), bp_get_displayed_user_fullname());
    ?>
</a></li>
	</ul>

<?php 
    /**
     * Fires after the markup for the navigation tabs for a user Blogs page.
     *
     * @since BuddyPress (1.0.0)
     */
    do_action('bp_blogs_blog_tabs');
}
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:63,代码来源:bp-blogs-template.php

示例7: setup_admin_bar

 /**
  * Set up bp-blogs integration with the WordPress admin bar.
  *
  * @since 1.5.0
  *
  * @see BP_Component::setup_admin_bar() for a description of arguments.
  *
  * @param array $wp_admin_nav See BP_Component::setup_admin_bar()
  *                            for description.
  * @return bool
  */
 public function setup_admin_bar($wp_admin_nav = array())
 {
     /**
      * Site/post/comment menus should not appear on single WordPress setups.
      *
      * Comments and posts made by users will still show in their activity.
      */
     if (!is_multisite()) {
         return false;
     }
     // Menus for logged in user.
     if (is_user_logged_in()) {
         // Setup the logged in user variables.
         $blogs_link = trailingslashit(bp_loggedin_user_domain() . bp_get_blogs_slug());
         // Add the "Sites" sub menu.
         $wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => __('Sites', 'buddypress'), 'href' => $blogs_link);
         // My Sites.
         $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-my-sites', 'title' => __('My Sites', 'buddypress'), 'href' => $blogs_link);
         // Create a Site.
         if (bp_blog_signup_enabled()) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-create', 'title' => __('Create a Site', 'buddypress'), 'href' => trailingslashit(bp_get_blogs_directory_permalink() . 'create'));
         }
     }
     parent::setup_admin_bar($wp_admin_nav);
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:36,代码来源:bp-blogs-loader.php

示例8: bp_blogs_blog_tabs

function bp_blogs_blog_tabs()
{
    global $bp, $groups_template;
    // Don't show these tabs on a user's own profile
    if (bp_is_my_profile()) {
        return false;
    }
    ?>

	<ul class="content-header-nav">
		<li<?php 
    if (bp_is_current_action('my-blogs') || !bp_current_action()) {
        ?>
 class="current"<?php 
    }
    ?>
><a href="<?php 
    echo trailingslashit(bp_displayed_user_domain() . bp_get_blogs_slug() . '/my-blogs');
    ?>
"><?php 
    printf(__("%s's Sites", 'buddypress'), bp_get_displayed_user_fullname());
    ?>
</a></li>
		<li<?php 
    if (bp_is_current_action('recent-posts')) {
        ?>
 class="current"<?php 
    }
    ?>
><a href="<?php 
    echo trailingslashit(bp_displayed_user_domain() . bp_get_blogs_slug() . '/recent-posts');
    ?>
"><?php 
    printf(__("%s's Recent Posts", 'buddypress'), bp_get_displayed_user_fullname());
    ?>
</a></li>
		<li<?php 
    if (bp_is_current_action('recent-comments')) {
        ?>
 class="current"<?php 
    }
    ?>
><a href="<?php 
    echo trailingslashit(bp_displayed_user_domain() . bp_get_blogs_slug() . '/recent-comments');
    ?>
"><?php 
    printf(__("%s's Recent Comments", 'buddypress'), bp_get_displayed_user_fullname());
    ?>
</a></li>
	</ul>

<?php 
    do_action('bp_blogs_blog_tabs', $current_tab);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:54,代码来源:bp-blogs-template.php

示例9: bp_blogs_creation_location

/**
 * Ensures that the 'Create a new site' link at wp-admin/my-sites.php points to the BP blog signup
 *
 * @since 1.6
 * @uses apply_filters() Filter bp_blogs_creation_location to alter the returned value
 *
 * @param string $url The original URL (points to wp-signup.php by default)
 * @return string The new URL
 */
function bp_blogs_creation_location($url)
{
    return apply_filters('bp_blogs_creation_location', trailingslashit(bp_get_root_domain() . '/' . bp_get_blogs_slug() . '/create', $url));
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:13,代码来源:bp-blogs-filters.php

示例10: setup_nav

 /**
  * Set up component navigation for bp-blogs.
  *
  * @see BP_Component::setup_nav() for a description of arguments.
  *
  * @param array $main_nav Optional. See BP_Component::setup_nav() for
  *        description.
  * @param array $sub_nav Optional. See BP_Component::setup_nav() for
  *        description.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     $bp = buddypress();
     /**
      * Blog/post/comment menus should not appear on single WordPress setups.
      * Although comments and posts made by users will still show on their
      * activity stream.
      */
     if (!is_multisite()) {
         return false;
     }
     // Add 'Sites' to the main navigation
     $count = (int) bp_get_total_blog_count_for_user();
     $class = 0 === $count ? 'no-count' : 'count';
     $nav_text = sprintf(__('Sites <span class="%s">%s</span>', 'buddypress'), esc_attr($class), number_format_i18n($count));
     $main_nav = array('name' => $nav_text, 'slug' => $this->slug, 'position' => 30, 'screen_function' => 'bp_blogs_screen_my_blogs', 'default_subnav_slug' => 'my-sites', 'item_css_id' => $this->id);
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $parent_url = trailingslashit($user_domain . bp_get_blogs_slug());
     $sub_nav[] = array('name' => __('My Sites', 'buddypress'), 'slug' => 'my-sites', 'parent_url' => $parent_url, 'parent_slug' => $bp->blogs->slug, 'screen_function' => 'bp_blogs_screen_my_blogs', 'position' => 10);
     // Setup navigation
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:kosir,项目名称:thatcamp-org,代码行数:39,代码来源:bp-blogs-loader.php


注:本文中的bp_get_blogs_slug函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。