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

时间:2017-09-29 13:28:18

标签: wordpress

我如何能够按以下顺序订购从循环接收的Wordpress文章:

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

使用类似于此的查询:

    $article_feed_query = new WP_Query( array( 
    'post_type' => 'post',
    'posts_per_page' => 10,
    'orderby' => 'date',
    'order' => 'desc',
    'offset' => 1,
    ));

1 个答案:

答案 0 :(得分:0)

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
    ));