<?php $my_query = new WP_Query( "cat=11&posts_per_page=1" );
if ( $my_query->have_posts() ) {
while ( $my_query->have_posts() ) {
$my_query->the_post();
the_excerpt();
}
}
wp_reset_postdata(); ?>
在上面写着\\u摘录的地方,为什么我不能添加其他代码?我猜这是因为它仍然在PHP标记中,但我不确定如何将两者分开。是否有办法在\\u摘录所在的部分添加其他代码?我想补充一下:<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="postdetails">
Written by <strong><?php the_author(); ?></strong>
<?php the_time (\'j F, Y\'); ?>
Posted in: <strong><?php the_category(\', \'); ?></strong>
<?php the_tags(); ?>
</div>
然后是摘录非常感谢。