本文整理汇总了PHP中bbp_is_single_user_topics函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_is_single_user_topics函数的具体用法?PHP bbp_is_single_user_topics怎么用?PHP bbp_is_single_user_topics使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_is_single_user_topics函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bbp_user_profile_url
<span class="vcard bbp-user-profile-link">
<a class="url fn n" href="<?php
bbp_user_profile_url();
?>
" title="<?php
printf(esc_attr__("%s's Profile", 'bbpress'), bbp_get_displayed_user_field('display_name'));
?>
" rel="me"><?php
_e('Profile', 'bbpress');
?>
</a>
</span>
</li>
<li class="<?php
if (bbp_is_single_user_topics()) {
?>
current<?php
}
?>
">
<span class='bbp-user-topics-created-link'>
<a href="<?php
bbp_user_topics_created_url();
?>
" title="<?php
printf(esc_attr__("%s's Topics Started", 'bbpress'), bbp_get_displayed_user_field('display_name'));
?>
"><?php
_e('Topics Started', 'bbpress');
?>
示例2: bbp_has_topics
//.........这里部分代码省略.........
// If any posts have been excluded specifically, Ignore those that are sticky.
if (!empty($stickies) && !empty($r['post__not_in'])) {
$stickies = array_diff($stickies, $r['post__not_in']);
}
// Fetch sticky posts that weren't in the query results
if (!empty($stickies)) {
// Query to use in get_posts to get sticky posts
$sticky_query = array('post_type' => bbp_get_topic_post_type(), 'post_parent' => 'any', 'meta_key' => '_bbp_last_active_time', 'meta_type' => 'DATETIME', 'orderby' => 'meta_value', 'order' => 'DESC', 'include' => $stickies);
// Cleanup
unset($stickies);
// Conditionally exclude private/hidden forum ID's
$exclude_forum_ids = bbp_exclude_forum_ids('array');
if (!empty($exclude_forum_ids)) {
$sticky_query['post_parent__not_in'] = $exclude_forum_ids;
}
// What are the default allowed statuses (based on user caps)
if (bbp_get_view_all()) {
$sticky_query['post_status'] = $r['post_status'];
// Lean on the 'perm' query var value of 'readable' to provide statuses
} else {
$sticky_query['post_status'] = $r['perm'];
}
// Get all stickies
$sticky_posts = get_posts($sticky_query);
if (!empty($sticky_posts)) {
// Get a count of the visible stickies
$sticky_count = count($sticky_posts);
// Merge the stickies topics with the query topics .
$bbp->topic_query->posts = array_merge($sticky_posts, $bbp->topic_query->posts);
// Adjust loop and counts for new sticky positions
$bbp->topic_query->found_posts = (int) $bbp->topic_query->found_posts + (int) $sticky_count;
$bbp->topic_query->post_count = (int) $bbp->topic_query->post_count + (int) $sticky_count;
// Cleanup
unset($sticky_posts);
}
}
}
}
// If no limit to posts per page, set it to the current post_count
if (-1 === $r['posts_per_page']) {
$r['posts_per_page'] = $bbp->topic_query->post_count;
}
// Add pagination values to query object
$bbp->topic_query->posts_per_page = $r['posts_per_page'];
$bbp->topic_query->paged = $r['paged'];
// Only add pagination if query returned results
if (((int) $bbp->topic_query->post_count || (int) $bbp->topic_query->found_posts) && (int) $bbp->topic_query->posts_per_page) {
// Limit the number of topics shown based on maximum allowed pages
if (!empty($r['max_num_pages']) && $bbp->topic_query->found_posts > $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count) {
$bbp->topic_query->found_posts = $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count;
}
// If pretty permalinks are enabled, make our pagination pretty
if (bbp_use_pretty_urls()) {
// User's topics
if (bbp_is_single_user_topics()) {
$base = bbp_get_user_topics_created_url(bbp_get_displayed_user_id());
// User's favorites
} elseif (bbp_is_favorites()) {
$base = bbp_get_favorites_permalink(bbp_get_displayed_user_id());
// User's subscriptions
} elseif (bbp_is_subscriptions()) {
$base = bbp_get_subscriptions_permalink(bbp_get_displayed_user_id());
// Root profile page
} elseif (bbp_is_single_user()) {
$base = bbp_get_user_profile_url(bbp_get_displayed_user_id());
// View
} elseif (bbp_is_single_view()) {
$base = bbp_get_view_url();
// Topic tag
} elseif (bbp_is_topic_tag()) {
$base = bbp_get_topic_tag_link();
// Page or single post
} elseif (is_page() || is_single()) {
$base = get_permalink();
// Forum archive
} elseif (bbp_is_forum_archive()) {
$base = bbp_get_forums_url();
// Topic archive
} elseif (bbp_is_topic_archive()) {
$base = bbp_get_topics_url();
// Default
} else {
$base = get_permalink((int) $r['post_parent']);
}
// Use pagination base
$base = trailingslashit($base) . user_trailingslashit(bbp_get_paged_slug() . '/%#%/');
// Unpretty pagination
} else {
$base = add_query_arg('paged', '%#%');
}
// Pagination settings with filter
$bbp_topic_pagination = apply_filters('bbp_topic_pagination', array('base' => $base, 'format' => '', 'total' => $r['posts_per_page'] === $bbp->topic_query->found_posts ? 1 : ceil((int) $bbp->topic_query->found_posts / (int) $r['posts_per_page']), 'current' => (int) $bbp->topic_query->paged, 'prev_text' => is_rtl() ? '→' : '←', 'next_text' => is_rtl() ? '←' : '→', 'mid_size' => 1));
// Add pagination to query object
$bbp->topic_query->pagination_links = paginate_links($bbp_topic_pagination);
// Remove first page from pagination
$bbp->topic_query->pagination_links = str_replace(bbp_get_paged_slug() . "/1/'", "'", $bbp->topic_query->pagination_links);
}
// Return object
return apply_filters('bbp_has_topics', $bbp->topic_query->have_posts(), $bbp->topic_query);
}
示例3: bbp_title
/**
* Custom page title for bbPress pages
*
* @since bbPress (r2788)
*
* @param string $title Optional. The title (not used).
* @param string $sep Optional, default is '»'. How to separate the
* various items within the page title.
* @param string $seplocation Optional. Direction to display title, 'right'.
* @uses bbp_is_single_user() To check if it's a user profile page
* @uses bbp_is_single_user_edit() To check if it's a user profile edit page
* @uses bbp_is_user_home() To check if the profile page is of the current user
* @uses get_query_var() To get the user id
* @uses get_userdata() To get the user data
* @uses bbp_is_single_forum() To check if it's a forum
* @uses bbp_get_forum_title() To get the forum title
* @uses bbp_is_single_topic() To check if it's a topic
* @uses bbp_get_topic_title() To get the topic title
* @uses bbp_is_single_reply() To check if it's a reply
* @uses bbp_get_reply_title() To get the reply title
* @uses is_tax() To check if it's the tag page
* @uses get_queried_object() To get the queried object
* @uses bbp_is_single_view() To check if it's a view
* @uses bbp_get_view_title() To get the view title
* @uses apply_filters() Calls 'bbp_raw_title' with the title
* @uses apply_filters() Calls 'bbp_profile_page_wp_title' with the title,
* separator and separator location
* @return string The tite
*/
function bbp_title($title = '', $sep = '»', $seplocation = '')
{
// Title array
$new_title = array();
/** Archives **************************************************************/
// Forum Archive
if (bbp_is_forum_archive()) {
$new_title['text'] = bbp_get_forum_archive_title();
// Topic Archive
} elseif (bbp_is_topic_archive()) {
$new_title['text'] = bbp_get_topic_archive_title();
/** Edit ******************************************************************/
// Forum edit page
} elseif (bbp_is_forum_edit()) {
$new_title['text'] = bbp_get_forum_title();
$new_title['format'] = esc_attr__('Forum Edit: %s', 'bbpress');
// Topic edit page
} elseif (bbp_is_topic_edit()) {
$new_title['text'] = bbp_get_topic_title();
$new_title['format'] = esc_attr__('Topic Edit: %s', 'bbpress');
// Reply edit page
} elseif (bbp_is_reply_edit()) {
$new_title['text'] = bbp_get_reply_title();
$new_title['format'] = esc_attr__('Reply Edit: %s', 'bbpress');
// Topic tag edit page
} elseif (bbp_is_topic_tag_edit()) {
$new_title['text'] = bbp_get_topic_tag_name();
$new_title['format'] = esc_attr__('Topic Tag Edit: %s', 'bbpress');
/** Singles ***************************************************************/
// Forum page
} elseif (bbp_is_single_forum()) {
$new_title['text'] = bbp_get_forum_title();
$new_title['format'] = esc_attr__('Forum: %s', 'bbpress');
// Topic page
} elseif (bbp_is_single_topic()) {
$new_title['text'] = bbp_get_topic_title();
$new_title['format'] = esc_attr__('Topic: %s', 'bbpress');
// Replies
} elseif (bbp_is_single_reply()) {
$new_title['text'] = bbp_get_reply_title();
// Topic tag page
} elseif (bbp_is_topic_tag() || get_query_var('bbp_topic_tag')) {
$new_title['text'] = bbp_get_topic_tag_name();
$new_title['format'] = esc_attr__('Topic Tag: %s', 'bbpress');
/** Users *****************************************************************/
// Profile page
} elseif (bbp_is_single_user()) {
// User is viewing their own profile
if (bbp_is_user_home()) {
$new_title['text'] = esc_attr_x('Your', 'User viewing his/her own profile', 'bbpress');
// User is viewing someone else's profile (so use their display name)
} else {
$new_title['text'] = sprintf(esc_attr_x("%s's", 'User viewing another users profile', 'bbpress'), get_userdata(bbp_get_user_id())->display_name);
}
// User topics created
if (bbp_is_single_user_topics()) {
$new_title['format'] = esc_attr__("%s Topics", 'bbpress');
// User rueplies created
} elseif (bbp_is_single_user_replies()) {
$new_title['format'] = esc_attr__("%s Replies", 'bbpress');
// User favorites
} elseif (bbp_is_favorites()) {
$new_title['format'] = esc_attr__("%s Favorites", 'bbpress');
// User subscriptions
} elseif (bbp_is_subscriptions()) {
$new_title['format'] = esc_attr__("%s Subscriptions", 'bbpress');
// User "home"
} else {
$new_title['format'] = esc_attr__("%s Profile", 'bbpress');
}
// Profile edit page
//.........这里部分代码省略.........
示例4: widget
//.........这里部分代码省略.........
?>
" title="<?php
printf(esc_attr__("Edit Your Profile", 'ipt_kb'));
?>
"><span class="glyphicon glyphicon-edit"></span> <?php
_e('Edit', 'bbpress');
?>
</a>
<?php
bbp_logout_link();
?>
</div>
<div class="clearfix"></div>
<div class="list-group">
<a href="<?php
bbp_user_profile_url(bbp_get_current_user_id());
?>
" class="list-group-item bbp-user-forum-role <?php
if (bbp_is_user_home() && bbp_is_single_user_profile()) {
echo 'active';
}
?>
">
<span class="glyphicon ipt-icomoon-user4"></span> <?php
printf(__('%s Forum Role', 'ipt_kb'), '<span class="badge">' . bbp_get_user_display_role(bbp_get_current_user_id()) . '</span>');
?>
</a>
<a href="<?php
bbp_user_topics_created_url(bbp_get_current_user_id());
?>
" class="list-group-item bbp-user-topic-count <?php
if (bbp_is_user_home() && bbp_is_single_user_topics()) {
echo 'active';
}
?>
">
<span class="glyphicon ipt-icomoon-bubbles4"></span> <?php
printf(__('%s Topics Started', 'ipt_kb'), '<span class="badge">' . bbp_get_user_topic_count_raw(bbp_get_current_user_id()) . '</span>');
?>
</a>
<a href="<?php
bbp_user_replies_created_url(bbp_get_current_user_id());
?>
" class="list-group-item bbp-user-reply-count <?php
if (bbp_is_user_home() && bbp_is_single_user_replies()) {
echo 'active';
}
?>
">
<span class="glyphicon ipt-icomoon-reply"></span> <?php
printf(__('%s Replies Created', 'ipt_kb'), '<span class="badge">' . bbp_get_user_reply_count_raw(bbp_get_current_user_id()) . '</span>');
?>
</a>
<?php
if (bbp_is_favorites_active()) {
?>
<a href="<?php
bbp_favorites_permalink(bbp_get_current_user_id());
?>
" class="list-group-item bbp-user-favorite-count <?php
if (bbp_is_user_home() && bbp_is_favorites()) {
echo 'active';
}
?>
示例5: cb_bbp_author_details
function cb_bbp_author_details($cb_author_id, $cb_desc = true)
{
$cb_author_email = get_the_author_meta('publicemail', $cb_author_id);
$cb_author_name = get_the_author_meta('display_name', $cb_author_id);
$cb_author_position = get_the_author_meta('position', $cb_author_id);
$cb_author_tw = get_the_author_meta('twitter', $cb_author_id);
$cb_author_go = get_the_author_meta('googleplus', $cb_author_id);
$cb_author_www = get_the_author_meta('url', $cb_author_id);
$cb_author_desc = get_the_author_meta('description', $cb_author_id);
$cb_author_posts = count_user_posts($cb_author_id);
$cb_author_output = NULL;
$cb_author_output .= '<div class="cb-author-details cb-bbp clearfix"><div class="cb-mask"><a href="' . bbp_get_user_profile_url() . '" title="' . bbp_get_displayed_user_field('display_name') . '" rel="me">' . get_avatar(bbp_get_displayed_user_field('user_email', 'raw'), apply_filters('bbp_single_user_details_avatar_size', 150)) . '</a></div><div class="cb-meta"><h3><a href="' . bbp_get_user_profile_url() . '" title="' . bbp_get_displayed_user_field('display_name') . '">' . $cb_author_name . '</a></h3>';
if ($cb_author_position != NULL) {
$cb_author_output .= '<div class="cb-author-position">' . $cb_author_position . '</div>';
}
if ($cb_author_desc != NULL && $cb_desc == true) {
$cb_author_output .= '<p class="cb-author-bio">' . $cb_author_desc . '</p>';
}
if ($cb_author_email != NULL || $cb_author_www != NULL || $cb_author_tw != NULL || $cb_author_go != NULL) {
$cb_author_output .= '<div class="cb-author-page-contact">';
}
if ($cb_author_email != NULL) {
$cb_author_output .= '<a href="mailto:' . $cb_author_email . '"><i class="icon-envelope-alt cb-tip-bot" title="' . __('Email', 'cubell') . '"></i></a>';
}
if ($cb_author_www != NULL) {
$cb_author_output .= ' <a href="' . $cb_author_www . '" target="_blank"><i class="icon-link cb-tip-bot" title="' . __('Website', 'cubell') . '"></i></a> ';
}
if ($cb_author_tw != NULL) {
$cb_author_output .= ' <a href="//www.twitter.com/' . $cb_author_tw . '" target="_blank" ><i class="icon-twitter cb-tip-bot" title="Twitter"></i></a>';
}
if ($cb_author_go != NULL) {
$cb_author_output .= ' <a href="' . $cb_author_go . '" rel="publisher" target="_top" title="Google+" class="cb-googleplus cb-tip-bot" ><img src="//ssl.gstatic.com/images/icons/gplus-32.png" data-src-retina="//ssl.gstatic.com/images/icons/gplus-64.png" alt="Google+" ></a>';
}
if ($cb_author_email != NULL || $cb_author_www != NULL || $cb_author_go != NULL || $cb_author_tw != NULL) {
$cb_author_output .= '</div>';
}
$cb_author_output .= '<div id="cb-user-nav"><ul>';
if (bbp_is_single_user_replies()) {
$cb_user_current = 'current';
}
$cb_author_output .= '<li class="';
if (bbp_is_single_user_topics()) {
$cb_author_output .= 'current';
}
$cb_author_output .= '"><span class="bbp-user-topics-created-link"><a href="' . bbp_get_user_topics_created_url() . '">' . __('Topics Started', 'bbpress') . '</a></span></li>';
$cb_author_output .= '<li class="';
if (bbp_is_single_user_replies()) {
$cb_author_output .= 'current';
}
$cb_author_output .= '"><span class="bbp-user-replies-created-link"><a href="' . bbp_get_user_replies_created_url() . '">' . __('Replies Created', 'bbpress') . '</a></span></li>';
if (bbp_is_favorites_active()) {
$cb_author_output .= '<li class="';
if (bbp_is_favorites()) {
$cb_author_output .= 'current';
}
$cb_author_output .= '"><span class="bbp-user-favorites-link"><a href="' . bbp_get_favorites_permalink() . '">' . __('Favorites', 'bbpress') . '</a></span></li>';
}
if (bbp_is_user_home() || current_user_can('edit_users')) {
if (bbp_is_subscriptions_active()) {
$cb_author_output .= '<li class="';
if (bbp_is_subscriptions()) {
$cb_author_output .= 'current';
}
$cb_author_output .= '"><span class="bbp-user-subscriptions-link"><a href="' . bbp_get_subscriptions_permalink() . '">' . __('Subscriptions', 'bbpress') . '</a></span></li>';
}
$cb_author_output .= '<li class="';
if (bbp_is_single_user_edit()) {
$cb_author_output .= 'current';
}
$cb_author_output .= '"><span class="bbp-user-edit-link"><a href="' . bbp_get_user_profile_edit_url() . '">' . __('Edit', 'bbpress') . '</a></span></li>';
}
$cb_author_output .= '</ul></div><!-- #cb-user-nav -->';
$cb_author_output .= '</div></div>';
return $cb_author_output;
}
示例6: bbp_has_topics
//.........这里部分代码省略.........
$sticky_offset++;
// Remove post from sticky posts array
$offset = array_search($sticky->ID, $stickies);
// Cleanup
unset($stickies[$offset]);
unset($sticky);
}
}
// If any posts have been excluded specifically, Ignore those that are sticky.
if (!empty($stickies) && !empty($post__not_in)) {
$stickies = array_diff($stickies, $post__not_in);
}
// Fetch sticky posts that weren't in the query results
if (!empty($stickies)) {
// Query to use in get_posts to get sticky posts
$sticky_query = array('post_type' => bbp_get_topic_post_type(), 'post_parent' => 'any', 'post_status' => $default_post_status, 'meta_key' => '_bbp_last_active_time', 'orderby' => 'meta_value', 'order' => 'DESC', 'include' => $stickies);
// Get all stickies
$sticky_posts = get_posts($sticky_query);
if (!empty($sticky_posts)) {
// Get a count of the visible stickies
$sticky_count = count($sticky_posts);
// Loop through stickies and add them to beginning of array
foreach ($sticky_posts as $sticky) {
$topics[] = $sticky;
}
// Loop through topics and add them to end of array
foreach ($bbp->topic_query->posts as $topic) {
$topics[] = $topic;
}
// Adjust loop and counts for new sticky positions
$bbp->topic_query->posts = $topics;
$bbp->topic_query->found_posts = (int) $bbp->topic_query->found_posts + (int) $sticky_count;
$bbp->topic_query->post_count = (int) $bbp->topic_query->post_count + (int) $sticky_count;
// Cleanup
unset($topics);
unset($stickies);
unset($sticky_posts);
}
}
}
}
// If no limit to posts per page, set it to the current post_count
if (-1 == $posts_per_page) {
$posts_per_page = $bbp->topic_query->post_count;
}
// Add pagination values to query object
$bbp->topic_query->posts_per_page = $posts_per_page;
$bbp->topic_query->paged = $paged;
// Only add pagination if query returned results
if (((int) $bbp->topic_query->post_count || (int) $bbp->topic_query->found_posts) && (int) $bbp->topic_query->posts_per_page) {
// Limit the number of topics shown based on maximum allowed pages
if (!empty($max_num_pages) && $bbp->topic_query->found_posts > $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count) {
$bbp->topic_query->found_posts = $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count;
}
// If pretty permalinks are enabled, make our pagination pretty
if ($wp_rewrite->using_permalinks()) {
// User's topics
if (bbp_is_single_user_topics()) {
$base = bbp_get_user_topics_created_url(bbp_get_displayed_user_id());
// User's favorites
} elseif (bbp_is_favorites()) {
$base = bbp_get_favorites_permalink(bbp_get_displayed_user_id());
// User's subscriptions
} elseif (bbp_is_subscriptions()) {
$base = bbp_get_subscriptions_permalink(bbp_get_displayed_user_id());
// Root profile page
} elseif (bbp_is_single_user()) {
$base = bbp_get_user_profile_url(bbp_get_displayed_user_id());
// View
} elseif (bbp_is_single_view()) {
$base = bbp_get_view_url();
// Topic tag
} elseif (bbp_is_topic_tag()) {
$base = bbp_get_topic_tag_link();
// Page or single post
} elseif (is_page() || is_single()) {
$base = get_permalink();
// Topic archive
} elseif (bbp_is_topic_archive()) {
$base = bbp_get_topics_url();
// Default
} else {
$base = get_permalink($post_parent);
}
// Use pagination base
$base = trailingslashit($base) . user_trailingslashit($wp_rewrite->pagination_base . '/%#%/');
// Unpretty pagination
} else {
$base = add_query_arg('paged', '%#%');
}
// Pagination settings with filter
$bbp_topic_pagination = apply_filters('bbp_topic_pagination', array('base' => $base, 'format' => '', 'total' => $posts_per_page == $bbp->topic_query->found_posts ? 1 : ceil((int) $bbp->topic_query->found_posts / (int) $posts_per_page), 'current' => (int) $bbp->topic_query->paged, 'prev_text' => '←', 'next_text' => '→', 'mid_size' => 1));
// Add pagination to query object
$bbp->topic_query->pagination_links = paginate_links($bbp_topic_pagination);
// Remove first page from pagination
$bbp->topic_query->pagination_links = str_replace($wp_rewrite->pagination_base . "/1/'", "'", $bbp->topic_query->pagination_links);
}
// Return object
return apply_filters('bbp_has_topics', $bbp->topic_query->have_posts(), $bbp->topic_query);
}
示例7: do_action
?>
<?php do_action( 'bbp_template_before_user_details' ); ?>
<div id="bbp-single-user-details">
<div id="bbp-user-avatar">
<span class='vcard'>
<a class="url fn n" href="<?php bbp_user_profile_url(); ?>" title="<?php bbp_displayed_user_field( 'display_name' ); ?>" rel="me">
<?php echo get_avatar( bbp_get_displayed_user_field( 'user_email' ), apply_filters( 'bbp_single_user_details_avatar_size', 150 ) ); ?>
</a>
</span>
</div><!-- #author-avatar -->
<div id="bbp-user-navigation">
<ul>
<li class="<?php if ( bbp_is_single_user_profile() ) :?>current<?php endif; ?>">
<span class="vcard bbp-user-profile-link">
<a class="url fn n" href="<?php bbp_user_profile_url(); ?>" title="<?php printf( __( "%s's Profile", 'bbpress' ), esc_attr( bbp_get_displayed_user_field( 'display_name' ) ) ); ?>" rel="me"><?php _e( 'Profile', 'bbpress' ); ?></a>
</span>
</li>
<li class="<?php if ( bbp_is_single_user_topics() ) :?>current<?php endif; ?>">
<span class='bbp-user-topics-created-link'>
<a href="<?php bbp_user_topics_created_url(); ?>" title="<?php printf( __( "%s's Topics Started", 'bbpress' ), esc_attr( bbp_get_displayed_user_field( 'display_name' ) ) ); ?>"><?php _e( 'Topics Started', 'bbpress' ); ?></a>
</span>
</li>
<li class="<?php if ( bbp_is_single_user_replies() ) :?>current<?php endif;