本文整理汇总了PHP中bbp_thread_replies函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_thread_replies函数的具体用法?PHP bbp_thread_replies怎么用?PHP bbp_thread_replies使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_thread_replies函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bbp_get_topic_pagination
/**
* Returns pagination links of a topic within the topic loop
*
* @since 2.0.0 bbPress (r2966)
*
* @param array $args This function supports these arguments:
* - topic_id: Topic id
* - before: Before the links
* - after: After the links
* @uses bbp_get_topic_id() To get the topic id
* @uses bbp_use_pretty_urls() To check if the site is using pretty URLs
* @uses user_trailingslashit() To add a trailing slash
* @uses trailingslashit() To add a trailing slash
* @uses get_permalink() To get the permalink of the topic
* @uses add_query_arg() To add query args
* @uses bbp_get_topic_reply_count() To get topic reply count
* @uses bbp_show_topic_lead() Are we showing the topic as a lead?
* @uses get_option() To get replies per page option
* @uses paginate_links() To paginate the links
* @uses apply_filters() Calls 'bbp_get_topic_pagination' with the links
* and arguments
* @return string Pagination links
*/
function bbp_get_topic_pagination($args = array())
{
// Bail if threading replies
if (bbp_thread_replies()) {
return;
}
// Parse arguments against default values
$r = bbp_parse_args($args, array('topic_id' => bbp_get_topic_id(), 'before' => '<span class="bbp-topic-pagination">', 'after' => '</span>'), 'get_topic_pagination');
// If pretty permalinks are enabled, make our pagination pretty
if (bbp_use_pretty_urls()) {
$base = trailingslashit(get_permalink($r['topic_id'])) . user_trailingslashit(bbp_get_paged_slug() . '/%#%/');
} else {
$base = add_query_arg('paged', '%#%', get_permalink($r['topic_id']));
}
// Get total and add 1 if topic is included in the reply loop
$total = bbp_get_topic_reply_count($r['topic_id'], true);
// Bump if topic is in loop
if (!bbp_show_lead_topic()) {
$total++;
}
// Add pagination to query object
$pagination_links = paginate_links(array('base' => $base, 'format' => '', 'total' => ceil((int) $total / (int) bbp_get_replies_per_page()), 'current' => 0, 'prev_next' => false, 'mid_size' => 2, 'end_size' => 3, 'add_args' => bbp_get_view_all() ? array('view' => 'all') : false));
if (!empty($pagination_links)) {
// Remove first page from pagination
if (bbp_use_pretty_urls()) {
$pagination_links = str_replace(bbp_get_paged_slug() . '/1/', '', $pagination_links);
} else {
$pagination_links = str_replace('&paged=1', '', $pagination_links);
}
// Add before and after to pagination links
$pagination_links = $r['before'] . $pagination_links . $r['after'];
}
return apply_filters('bbp_get_topic_pagination', $pagination_links, $args);
}
示例2: bbp_get_topic_pagination_count
/**
* Return the topic pagination count
*
* @since bbPress (r2519)
*
* @uses bbp_number_format() To format the number value
* @uses bbp_show_lead_topic() Are we showing the topic as a lead?
* @uses apply_filters() Calls 'bbp_get_topic_pagination_count' with the
* pagination count
* @return string Topic pagination count
*/
function bbp_get_topic_pagination_count()
{
$bbp = bbpress();
// Define local variable(s)
$retstr = '';
// Set pagination values
$start_num = intval(($bbp->reply_query->paged - 1) * $bbp->reply_query->posts_per_page) + 1;
$from_num = bbp_number_format($start_num);
$to_num = bbp_number_format($start_num + ($bbp->reply_query->posts_per_page - 1) > $bbp->reply_query->found_posts ? $bbp->reply_query->found_posts : $start_num + ($bbp->reply_query->posts_per_page - 1));
$total_int = (int) $bbp->reply_query->found_posts;
$total = bbp_number_format($total_int);
// We are threading replies
if (bbp_thread_replies() && bbp_is_single_topic()) {
return;
$walker = new BBP_Walker_Reply();
$threads = (int) $walker->get_number_of_root_elements($bbp->reply_query->posts);
// Adjust for topic
$threads--;
$retstr = sprintf(_n('Viewing %1$s reply thread', 'Viewing %1$s reply threads', $threads, 'bbbpress'), bbp_number_format($threads));
// We are not including the lead topic
} elseif (bbp_show_lead_topic()) {
// Several replies in a topic with a single page
if (empty($to_num)) {
$retstr = sprintf(_n('Viewing %1$s reply', 'Viewing %1$s replies', $total_int, 'bbpress'), $total);
// Several replies in a topic with several pages
} else {
$retstr = sprintf(_n('Viewing %2$s replies (of %4$s total)', 'Viewing %1$s replies - %2$s through %3$s (of %4$s total)', $bbp->reply_query->post_count, 'bbpress'), $bbp->reply_query->post_count, $from_num, $to_num, $total);
}
// We are including the lead topic
} else {
// Several posts in a topic with a single page
if (empty($to_num)) {
$retstr = sprintf(_n('Viewing %1$s post', 'Viewing %1$s posts', $total_int, 'bbpress'), $total);
// Several posts in a topic with several pages
} else {
$retstr = sprintf(_n('Viewing %2$s post (of %4$s total)', 'Viewing %1$s posts - %2$s through %3$s (of %4$s total)', $bbp->reply_query->post_count, 'bbpress'), $bbp->reply_query->post_count, $from_num, $to_num, $total);
}
}
// Filter and return
return apply_filters('bbp_get_topic_pagination_count', esc_html($retstr));
}
示例3: _e
<?php
_e('Replies', 'bbpress');
?>
<?php
}
?>
</div><!-- .bbp-reply-content -->
</li><!-- .bbp-header -->
<li class="bbp-body">
<?php
if (bbp_thread_replies()) {
?>
<?php
bbp_list_replies();
?>
<?php
} else {
?>
<?php
while (bbp_replies()) {
bbp_the_reply();
?>
示例4: enqueue_scripts
/**
* Enqueue the required Javascript files
*
* @since bbPress (r3732)
*
* @uses bbp_is_single_forum() To check if it's the forum page
* @uses bbp_is_single_topic() To check if it's the topic page
* @uses bbp_thread_replies() To check if threaded replies are enabled
* @uses bbp_is_single_user_edit() To check if it's the profile edit page
* @uses wp_enqueue_script() To enqueue the scripts
*/
public function enqueue_scripts()
{
// Setup scripts array
$scripts = array();
// Always pull in jQuery for TinyMCE shortcode usage
if (bbp_use_wp_editor()) {
$scripts['bbpress-editor'] = array('file' => 'js/editor.js', 'dependencies' => array('jquery'));
}
// Forum-specific scripts
if (bbp_is_single_forum()) {
$scripts['bbpress-forum'] = array('file' => 'js/forum.js', 'dependencies' => array('jquery'));
}
// Topic-specific scripts
if (bbp_is_single_topic()) {
// Topic favorite/unsubscribe
$scripts['bbpress-topic'] = array('file' => 'js/topic.js', 'dependencies' => array('jquery'));
// Hierarchical replies
if (bbp_thread_replies()) {
$scripts['bbpress-reply'] = array('file' => 'js/reply.js', 'dependencies' => array('jquery'));
}
}
// User Profile edit
if (bbp_is_single_user_edit()) {
$scripts['bbpress-user'] = array('file' => 'js/user.js', 'dependencies' => array('user-query'));
}
// Filter the scripts
$scripts = apply_filters('bbp_default_scripts', $scripts);
// Enqueue the scripts
foreach ($scripts as $handle => $attributes) {
bbp_enqueue_script($handle, $attributes['file'], $attributes['dependencies'], $this->version, 'screen');
}
}
示例5: enqueue_scripts
/**
* Enqueue the required Javascript files
*
* @since bbPress (r3732)
*
* @uses bbp_is_single_topic() To check if it's the topic page
* @uses bbp_is_single_user_edit() To check if it's the profile edit page
* @uses wp_enqueue_script() To enqueue the scripts
*/
public function enqueue_scripts()
{
// Always pull in jQuery for TinyMCE shortcode usage
if (bbp_use_wp_editor()) {
wp_enqueue_script('jquery');
}
// Topic-specific scripts
if (bbp_is_single_topic()) {
// Topic favorite/unsubscribe
wp_enqueue_script('bbpress-topic', $this->url . 'js/topic.js', array('jquery'), $this->version);
// Hierarchical replies
if (bbp_thread_replies()) {
wp_enqueue_script('bbpress-reply', $this->url . 'js/reply.js', array(), $this->version);
}
}
// User Profile edit
if (bbp_is_single_user_edit()) {
wp_enqueue_script('user-profile');
}
}
示例6: bbp_reply_id
<a href="#<?php
bbp_reply_id();
?>
" class="" data-container="body" data-toggle="popover" data-rel="popover" data-html="true" data-placement="right" data-original-title="" data-content="<?php
echo esc_attr($reply_manage);
?>
">
<span class="edit-link text-muted"><span class="icon-cog"></span> <?php
_e('Details', 'firmasite');
?>
</span>
</a>
<?php
if (class_exists('BBP_Walker_Reply') && bbp_thread_replies()) {
?>
<div class="pull-left text-muted">
<?php
bbp_reply_to_link(array('id' => bbp_get_reply_id(), 'link_before' => '<span class="icon-reply"></span> ', 'link_after' => ' '));
?>
</div>
<?php
}
?>
<?php
do_action('bbp_theme_after_reply_author_details');
?>
</div><!-- .bbp-reply-author -->