我试着放了这个:
<?php $count = count($custom_posts); ?>
<h2><?php echo $count; ?></h2>
在循环结束时:
<?php if ( bbp_get_forum_title() == \'Test Forum 1\' ) : ?>
<?php $custom_posts = new WP_Query(); ?>
<?php $custom_posts->query(\'post_type=blocks&location=Business and Finance&order=DESC\'); ?>
<?php while ($custom_posts->have_posts()) : $custom_posts->the_post(); ?>
<div class="ad">
<?php the_content(); ?>
</div>
<?php $count = count($custom_posts); ?>
<h2><?php echo $count; ?></h2>
<?php endwhile; ?>
<?php endif; ?>
但我得到的不是帖子总数,而是以下输出:
翻译1
Lorem ipsum dolor sit amet,concetetuer adipising elit,sed diam nonumm nibh euismod tincidunt ut laoreet dolore magna aliquam erat volipat。Ut wisi enim 1
有什么建议可以解决这个问题吗?