自定义页面中获取wordpress中添加的最新文章
工具/原料
wordpress
方法/步骤
1
引用wp-blog-header.php文件,如wordpress放到blog目录中,需要加入目录信息,如下require('blog/wp-blog-header.php');
2
使用get_posts获取数据//定义一个数组,存储设置信息$args = array( 'numberposts' => 10, 'post_status'=>"publish",'post_type'=>"post",'orderby'=>"post_date");依次为,数量=10,发布的文章,提取post类型(wordpress有很多类型),按日期排序。//使用get_posts获取数据 $postslist = get_posts($args);
上一篇:广州清代-民国遗迹的历史之旅
下一篇:百莲凯祛皱偏方:五大祛皱食谱