我得到了这个函数:
<?php bbp_get_topic_pagination_count(); ?>
,最终输出如下所示:
查看10个回复- 1到10(共13个)
我只想得到(过滤)"总数"(在上面的例子中是13)。
有什么建议吗?
像这样?
function custom_function() {
global $bbp;
return bbp_number_format( $bbp->reply_query->found_posts );
}
function custom_bbp_get_total() {
global $bbp;
$total = bbp_number_format( $bbp->reply_query->found_posts );
return $total;
}
看起来这个数字是从$bbp->reply_query->found_posts
获取的。就用这个表达。(如果要从函数内部获取值,请确保发出global $bbp;
)
这只是一个疯狂的猜测,但是考虑到$bbp
是一个全局的,并且假设它没有以任何有害的方式改变作为执行该函数的副作用,您应该能够准确地复制在函数中分配给$total
的内容,即您可以得到这样的值:
$total = $bbp->reply_query->found_posts;