• Hello, I have these arguments for my WP_Query. And it works perfectly. But What I need more from it, is so that I could be able to specific post to the top. For example post with id 128 should be first but also order by custom fields.

    $args = array(
                           'post_type' => $type,
                           'post_status' => 'publish',
                           'posts_per_page' => $ppp,
                           'paged' => 1,
                           'meta_query' => array(array(
                              'key'		=> 'iki',
                              'compare'	=> '>=',
                              'value'		=> $today,
                            )),
                            'orderby' => array(
                            'iki' => 'ASC',
                            ),
                         );

    Could I add in orderby array additional parameter?

    • This topic was modified 6 years, 3 months ago by duocia.
Viewing 2 replies - 1 through 2 (of 2 total)
  • I think you can set that post as “sticky” in wordpress, that way it will show first.

    Moderator bcworkz

    (@bcworkz)

    Swayam is correct, for the post you want to always be on top, checkmark the stick option under Visibility in the Publish meta box of its post edit screen. There’s a similar check box in the quick edit dialog.

    You cannot specify specific ordering of individual posts by using the orderby argument, you can only specify certain criteria be used in the ordering, like author or title. It is possible to use PHP code to directly manipulate the array of posts before they are output, but marking as sticky is far easier and sounds like it will meet your needs.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Multiple loop orderby’ is closed to new replies.