我是Wordpress的新手,我想在我的php文件中找到所有帖子 .
global $post;
$args = array('posts_per_page' => 10,
'order'=> 'ASC',
'orderby' => 'date'
);
$postslist = get_posts( $args );
if($postslist) {
foreach ( $postslist as $post ) :
setup_postdata( $post );
?>
<p><?php the_date(); ?></p>
<p><?php the_title(); ?></p>
<p><?php the_excerpt(); ?></p>
<?php the_attachment_link($post->ID, false); ?>
<?php
endforeach;
}
wp_reset_postdata();
?>
Headers ,日期和描述确实出来了但不是附件 . 我需要显示所有帖子以及没有附件的帖子 . 现在它说“缺少附件” .
提前致谢 :-)
1 回答
You can try like this...