我想显示帖子类别名称“futureblog”。我的代码如下。
<?php if ( have_posts() ) while ( have_posts() ) : the_post();
echo '<div class="entry-content">';
the_content('<span class="read_more">read more</span>');
echo '</div>';
<?php endif; ?>
答案 0 :(得分:0)
这是你想要的。
<?php $wp_query = new WP_Query(); $wp_query->query('showposts=5'.'&category_name=futureblog');
while ($wp_query->have_posts()) : $wp_query->the_post();
echo '<div class="entry-content">';
the_content('<span class="read_more">read more</span>');
echo '</div>';
<?php endif; ?>
答案 1 :(得分:0)
<?php
$query = new WP_Query( array('category_name' =>'demo','posts_per_page' => -1 ) );
while($query->have_posts()) : $query->the_post();
?>
<ul>
<li>
<h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<?php the_content(); ?>
</li>
</ul>
<?php endwhile; ?>