本文整理汇总了PHP中bp_get_blogs_root_slug函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_blogs_root_slug函数的具体用法?PHP bp_get_blogs_root_slug怎么用?PHP bp_get_blogs_root_slug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_blogs_root_slug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_blogs_creation_location
/**
* Ensure that the 'Create a new site' link at wp-admin/my-sites.php points to the BP blog signup.
*
* @since BuddyPress (1.6.0)
*
* @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)
{
/**
* Filters the 'Create a new site' link URL.
*
* @since BuddyPress (1.6.0)
*
* @param string $value URL for the 'Create a new site' signup page.
*/
return apply_filters('bp_blogs_creation_location', trailingslashit(bp_get_root_domain() . '/' . bp_get_blogs_root_slug() . '/create', $url));
}
示例2: bp_adminbar_blogs_menu
/**
* Add a Sites menu to the BuddyBar.
*
* @since BuddyPress (1.0.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>';
}
}
示例3: do_action
}
?>
<div class="padder">
<?php
do_action('bp_before_directory_blogs');
?>
<form action="" method="post" id="blogs-directory-form" class="dir-form">
<h3><?php
_e('Site Directory', 'buddypress');
if (is_user_logged_in() && bp_blog_signup_enabled()) {
?>
<a class="button" href="<?php
echo bp_get_root_domain() . '/' . bp_get_blogs_root_slug() . '/create/';
?>
"><?php
_e('Create a Site', 'buddypress');
?>
</a><?php
}
?>
</h3>
<?php
do_action('bp_before_directory_blogs_content');
?>
<div id="blog-dir-search" class="dir-search" role="search">
示例4: create_dummy_post
/**
* Update the global $post with create screen data.
*
* @since BuddyPress (1.7.0)
*/
public function create_dummy_post()
{
// Title based on ability to create blogs
if (is_user_logged_in() && bp_blog_signup_enabled()) {
$title = '<a class="button bp-title-button" href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_blogs_root_slug()) . '">' . __('Sites', 'buddypress') . '</a> ' . __('Create a Site', 'buddypress');
} else {
$title = __('Sites', 'buddypress');
}
bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => $title, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
}
示例5: bp_core_action_search_site
/**
* A javascript-free implementation of the search functions in BuddyPress.
*
* @param string $slug The slug to redirect to for searching.
*/
function bp_core_action_search_site($slug = '')
{
if (!bp_is_current_component(bp_get_search_slug())) {
return;
}
if (empty($_POST['search-terms'])) {
bp_core_redirect(bp_get_root_domain());
return;
}
$search_terms = stripslashes($_POST['search-terms']);
$search_which = !empty($_POST['search-which']) ? $_POST['search-which'] : '';
$query_string = '/?s=';
if (empty($slug)) {
switch ($search_which) {
case 'posts':
$slug = '';
$var = '/?s=';
// If posts aren't displayed on the front page, find the post page's slug.
if ('page' == get_option('show_on_front')) {
$page = get_post(get_option('page_for_posts'));
if (!is_wp_error($page) && !empty($page->post_name)) {
$slug = $page->post_name;
$var = '?s=';
}
}
break;
case 'blogs':
$slug = bp_is_active('blogs') ? bp_get_blogs_root_slug() : '';
break;
case 'forums':
$slug = bp_is_active('forums') ? bp_get_forums_root_slug() : '';
$query_string = '/?fs=';
break;
case 'groups':
$slug = bp_is_active('groups') ? bp_get_groups_root_slug() : '';
break;
case 'members':
default:
$slug = bp_get_members_root_slug();
break;
}
if (empty($slug) && 'posts' != $search_which) {
bp_core_redirect(bp_get_root_domain());
return;
}
}
bp_core_redirect(apply_filters('bp_core_search_site', home_url($slug . $query_string . urlencode($search_terms)), $search_terms));
}
示例6: do_action
<div id="content">
<div class="padder" role="main">
<?php
do_action('bp_before_create_blog_content_template');
?>
<?php
do_action('template_notices');
?>
<h3><?php
_e('Create a Site', 'buddypress');
?>
<a class="button" href="<?php
echo trailingslashit(bp_get_root_domain() . '/' . bp_get_blogs_root_slug());
?>
"><?php
_e('Site Directory', 'buddypress');
?>
</a></h3>
<?php
do_action('bp_before_create_blog_content');
?>
<?php
if (bp_blog_signup_enabled()) {
?>
<?php
示例7: bp_adminbar_random_menu
function bp_adminbar_random_menu()
{
global $bp;
?>
<li class="align-right" id="bp-adminbar-visitrandom-menu">
<a href="#"><?php
_e('Visit', 'buddypress');
?>
</a>
<ul class="random-list">
<li><a href="<?php
echo trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug()) . '?random-member';
?>
" rel="nofollow"><?php
_e('Random Member', 'buddypress');
?>
</a></li>
<?php
if (bp_is_active('groups')) {
?>
<li class="alt"><a href="<?php
echo trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug()) . '?random-group';
?>
" rel="nofollow"><?php
_e('Random Group', 'buddypress');
?>
</a></li>
<?php
}
?>
<?php
if (is_multisite() && bp_is_active('blogs')) {
?>
<li><a href="<?php
echo trailingslashit(bp_get_root_domain() . '/' . bp_get_blogs_root_slug()) . '?random-blog';
?>
" rel="nofollow"><?php
_e('Random Site', 'buddypress');
?>
</a></li>
<?php
}
?>
<?php
do_action('bp_adminbar_random_menu');
?>
</ul>
</li>
<?php
}
示例8: bp_get_blogs_directory_permalink
/**
* Return blog directory permalink.
*
* @since BuddyPress (1.5.0)
*
* @uses apply_filters()
* @uses trailingslashit()
* @uses bp_get_root_domain()
* @uses bp_get_blogs_root_slug()
*
* @return string The URL of the Blogs directory.
*/
function bp_get_blogs_directory_permalink()
{
/**
* Filters the blog directory permalink.
*
* @since BuddyPress (1.5.0)
*
* @param string $value Permalink URL for the blog directory.
*/
return apply_filters('bp_get_blogs_directory_permalink', trailingslashit(bp_get_root_domain() . '/' . bp_get_blogs_root_slug()));
}
示例9: bp_create_blog_link
function bp_create_blog_link()
{
global $bp;
if (bp_is_my_profile()) {
echo apply_filters('bp_create_blog_link', '<a href="' . bp_get_root_domain() . '/' . bp_get_blogs_root_slug() . '/create/">' . __('Create a Site', 'buddypress') . '</a>');
}
}
示例10: bp_get_blog_create_button
/**
* Get the Create a Site button.
*
* @since BuddyPress (2.0.0)
*
* @return string
*/
function bp_get_blog_create_button()
{
if (!is_user_logged_in()) {
return false;
}
if (!bp_blog_signup_enabled()) {
return false;
}
$button_args = array('id' => 'create_blog', 'component' => 'blogs', 'link_text' => __('Create a Site', 'buddypress'), 'link_title' => __('Create a Site', 'buddypress'), 'link_class' => 'button blog-create bp-title-button', 'link_href' => trailingslashit(bp_get_root_domain()) . trailingslashit(bp_get_blogs_root_slug()) . trailingslashit('create'), 'wrapper' => false);
return bp_get_button(apply_filters('bp_get_blog_create_button', $button_args));
}
示例11: widget
/**
* Display the networkwide posts widget.
*
* @see WP_Widget::widget() for description of parameters.
*
* @param array $args Widget arguments.
* @param array $instance Widget settings, as saved by the user.
*/
function widget($args, $instance)
{
$title = !empty($instance['title']) ? esc_html($instance['title']) : __('Recent Networkwide Posts', 'buddypress');
if (!empty($instance['link_title'])) {
$title = '<a href="' . trailingslashit(bp_get_root_domain()) . trailingslashit(bp_get_blogs_root_slug()) . '">' . esc_html($title) . '</a>';
}
echo $args['before_widget'];
echo $args['before_title'] . $title . $args['after_title'];
if (empty($instance['max_posts']) || !$instance['max_posts']) {
$instance['max_posts'] = 10;
}
?>
<?php
// Override some of the contextually set parameters for bp_has_activities()
?>
<?php
if (bp_has_activities(array('action' => 'new_blog_post', 'max' => $instance['max_posts'], 'per_page' => $instance['max_posts'], 'user_id' => 0, 'scope' => false, 'object' => false, 'primary_id' => false))) {
?>
<ul id="blog-post-list" class="activity-list item-list">
<?php
while (bp_activities()) {
bp_the_activity();
?>
<li>
<div class="activity-content" style="margin: 0">
<div class="activity-header">
<?php
bp_activity_action();
?>
</div>
<?php
if (bp_get_activity_content_body()) {
?>
<div class="activity-inner">
<?php
bp_activity_content_body();
?>
</div>
<?php
}
?>
</div>
</li>
<?php
}
?>
</ul>
<?php
} else {
?>
<div id="message" class="info">
<p><?php
_e('Sorry, there were no posts found. Why not write one?', 'buddypress');
?>
</p>
</div>
<?php
}
?>
<?php
echo $args['after_widget'];
?>
<?php
}
示例12: bp_blogs_creation_location
/**
* Ensure that the 'Create a new site' link at wp-admin/my-sites.php points to the BP blog signup.
*
* @since BuddyPress (1.6.0)
*
* @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_root_slug() . '/create', $url));
}
示例13: bp_core_action_search_site
/**
* A javascript free implementation of the search functions in BuddyPress
*
* @package BuddyPress Core
* @global object $bp Global BuddyPress settings object
* @param string $slug The slug to redirect to for searching.
*/
function bp_core_action_search_site($slug = '')
{
global $bp;
if (!bp_is_current_component(bp_get_search_slug())) {
return;
}
if (empty($_POST['search-terms'])) {
bp_core_redirect(bp_get_root_domain());
return;
}
$search_terms = stripslashes($_POST['search-terms']);
$search_which = !empty($_POST['search-which']) ? $_POST['search-which'] : '';
$query_string = '/?s=';
if (empty($slug)) {
switch ($search_which) {
case 'posts':
$slug = '';
$var = '/?s=';
break;
case 'blogs':
$slug = bp_is_active('blogs') ? bp_get_blogs_root_slug() : '';
break;
case 'forums':
$slug = bp_is_active('forums') ? bp_get_forums_root_slug() : '';
$query_string = '/?fs=';
break;
case 'groups':
$slug = bp_is_active('groups') ? bp_get_groups_root_slug() : '';
break;
case 'members':
default:
$slug = bp_get_members_root_slug();
break;
}
if (empty($slug) && 'posts' != $search_which) {
bp_core_redirect(bp_get_root_domain());
return;
}
}
bp_core_redirect(apply_filters('bp_core_search_site', home_url($slug . $query_string . urlencode($search_terms)), $search_terms));
}
示例14: widget
function widget($args, $instance)
{
global $bp;
extract($args);
$link_title = !empty($instance['link_title']);
echo $before_widget;
echo $before_title;
if ($link_title) {
$dir_link = trailingslashit(bp_get_root_domain()) . trailingslashit(bp_get_blogs_root_slug());
$title = '<a href="' . $dir_link . '">' . $instance['title'] . '</a>';
} else {
$title = $instance['title'];
}
echo $title;
echo $after_title;
if (empty($instance['max_posts']) || !$instance['max_posts']) {
$instance['max_posts'] = 10;
}
// Load more items that we need, because many will be filtered out by privacy
$real_max = $instance['max_posts'] * 10;
$counter = 0;
$query_string = empty($instance['include_groupblog']) ? 'action=new_blog_post' : 'action=new_blog_post,new_groupblog_post';
$query_string .= '&max=' . $real_max . '&per_page=' . $real_max;
if (bp_has_activities($query_string)) {
?>
<ul id="blog-post-list" class="activity-list item-list">
<?php
while (bp_activities()) {
bp_the_activity();
?>
<?php
if ($counter >= $instance['max_posts']) {
break;
}
?>
<li>
<div class="activity-content" style="margin: 0">
<div class="activity-avatar">
<?php
bp_activity_avatar();
?>
</div>
<div class="activity-header">
<?php
bp_activity_action();
?>
</div>
<?php
if (bp_get_activity_content_body()) {
?>
<?php
bp_activity_content_body();
?>
<?php
}
?>
</div>
</li>
<?php
$counter++;
?>
<?php
}
?>
</ul>
<p class="cac-more-link"><a href="<?php
bp_blogs_directory_permalink();
?>
">More Blogs</a></p>
<?php
} else {
?>
<div id="message" class="info">
<p><?php
_e('Sorry, there were no blog posts found. Why not write one?', 'buddypress');
?>
</p>
</div>
<?php
}
?>
<?php
echo $after_widget;
?>
<?php
//.........这里部分代码省略.........
示例15: bp_get_blog_create_button
/**
* Get the Create a Site button.
*
* @since BuddyPress (2.0.0)
*
* @return string
*/
function bp_get_blog_create_button()
{
if (!is_user_logged_in()) {
return false;
}
if (!bp_blog_signup_enabled()) {
return false;
}
$button_args = array('id' => 'create_blog', 'component' => 'blogs', 'link_text' => __('Create a Site', 'buddypress'), 'link_title' => __('Create a Site', 'buddypress'), 'link_class' => 'blog-create no-ajax', 'link_href' => trailingslashit(bp_get_root_domain()) . trailingslashit(bp_get_blogs_root_slug()) . trailingslashit('create'), 'wrapper' => false, 'block_self' => false);
/**
* Filters the Create a Site button.
*
* @since BuddyPress (2.0.0)
*
* @param array $button_args Array of arguments to be used for the Create a Site button.
*/
return bp_get_button(apply_filters('bp_get_blog_create_button', $button_args));
}