你试过抄本上的例子吗?
<?php
global $post;
$args = array( \'numberposts\' => $number, \'category\' => 6, \'order\' => \'ASC\', \'orderby\' => \'post_date\' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
这是一个经过修改的版本,应该适合您的需要。您是否也确定该类别存在?
Edit:
<?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(\'showposts=\' . $numberposts . \'&cat=6&orderby=date&order=ASC\'); ?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<!-- your content -->
<?php endwhile; ?>
<?php $wp_query = null; $wp_query = $temp; ?>