wordpress获取内容页最新文章代码
<?php
// 设置查询参数
$args = array(
    'numberposts' => 8, // 文章数量
    'post_status' => 'publish', // 文章状态
    'post_type' => 'post', // 文章类型
    'orderby' => 'post_date',
    'order' => 'DESC'
);
 
// 获取最新文章
$latest_posts = get_posts($args);
 
// 输出最新文章
if ($latest_posts) {
    foreach ($latest_posts as $post) {
        setup_postdata($post);
        ?>
		<dl>
        <dd class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></dd>
        </dl>
        <?php
    }
    wp_reset_postdata(); 
}
?>