首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >来自WP_Query的自定义文章顺序

来自WP_Query的自定义文章顺序
EN

Stack Overflow用户
提问于 2017-09-29 21:28:18
回答 1查看 649关注 0票数 1

我如何能够按照以下顺序对从循环中收到的Wordpress文章进行排序:

1、6、2、7、3、8、4、9、5、10

使用类似如下的查询:

代码语言:javascript
运行
复制
    $article_feed_query = new WP_Query( array( 
    'post_type' => 'post',
    'posts_per_page' => 10,
    'orderby' => 'date',
    'order' => 'desc',
    'offset' => 1,
    ));
EN

回答 1

Stack Overflow用户

发布于 2017-09-29 22:05:42

代码语言:javascript
运行
复制
Here is the solution for set the custom order.

step1: Please add this plugin https://wordpress.org/plugins/simple-custom-post-order/.
step2: go to setting and check your post type that you want to change the order.
step3: go to your post and drag and drop the post from admin. 
step4: add this below code in your template 



 $article_feed_query = new WP_Query( array( 
    'post_type' => 'post',
    'posts_per_page' => 10
    ));
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46489850

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档