
<?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();
}
?>
wordpress建站,不要第三方插件实现图片自动添加水印(亲测有效)
wordpress建站,如何实现多个网站调用的文章图片来自同一个文件夹
标签: wordpress代码, wordpress入门
上面是“wordpress获取内容页最新文章代码”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_16820.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

svg标签属性有哪些?