Multiple orderby
with different sort order
values are possible as of WordPress 4.0, take a look at the codex page for WP_Query
– Order – Orderby Parameters. There is an related Make WordPress Core article too.
The following example would comply to what you want:
$query = new WP_Query(
array(
'orderby' => array(
'name' => 'ASC',
'date' => 'ASC'
)
)
);
Related Posts:
- visually sort ordering “custom post types” for end users
- Custom Table Column Sortable by Taxonomy Query
- How do I allow users to sort posts? [duplicate]
- Sorting results from JSON-API on custom fields
- Sort users in get_users() in custom order
- Sort by custom field value
- How to sort posts with the first 2 or 3 by latest, and the rest is random?
- Get “wp_get_nav_menu_items” to sort alphabetically [duplicate]
- Ascending sort order for monthly & category view, i.e. ?m=201204, ?cat=4
- Adding Sorting to Website?
- Sorting by tag or category
- get_terms orderby name as numbers
- Creating a category page by alphabet
- Sorting get_post_ancestors array
- wordpress custom_meta ordering of timestamps
- Sorting for custom column in WordPress admin post table
- Help alphabetically sorting $terms from get terms(‘wpsc_product_category’
- Vertical alphabetically post columns
- Advanced custom fields sort repeater by date
- Displaying posts sorting by a custom criterion
- Sorting custom post type by usermeta
- Sort posts by meta key that is serialised with other meta keys
- orderby field – list of available options?
- User Query sort on custom field then name
- WP Query sort by meta value
- Best Practices for a Completely Customizable Homepage – without plugins
- Sorting posts by custom field value
- How do I create a sort capability by Title, Category, Author, Date?
- How to avoid duplicating same meta_value?
- Sorting/Filter posts from front-end in WordPress blog
- ‘sort_column’ => ‘menu_order’ not working
- Sort scheduled posts in ascending order by default
- How to sort by number
- sort items by randomness
- inner foreach loop sorting
- Sortby parameter to sort users
- Update meta_key value for a page
- Sort my event calendar by date
- Table Sorter sort by span title?
- make two custom columns sortables
- How to display remaining post ( in post__in ) if posts are less then post per page?
- ACF pro: Group teaser by datepicker year and display custom sub fields [closed]
- Sorting in WP_List_Table class
- Sort an array with an ACF meta key
- display wordpress user who published a pending post of another user
- Static front page and orderby
- Advanced sorting of content in wordpress [closed]
- Sort posts by first content letter
- Grouping posts starting with same letter
- Getshopped (WP-e-commerce): show all protucts on one admin page for drag-and-drop ordering [closed]
- List CPT by menu_order with children right after parent
- Multidimensional array sort?
- How can users sort multiple pages?
- How do i Sort my Posts
- How to resort my id in wordpress?
- How do I set the default admin sort order for a custom post type to a custom column?
- Sort posts by category name and title
- How to Group Posts by the First Letter or Number?
- Custom order of terms for custom taxonomy in admin and website
- What is the most efficient way to search users by their display name?
- WordPress Menu Disappears when $query->query_vars[‘meta_key’] is set
- sort events based on event date custom field
- Sorting Posts Via Custom Taxonomy Values Using Checkboxes?
- How to make orderby ‘meta_value_num’ OPTIONAL?
- Custom-post-type-archive: posts sorted/filtered by year?
- Sort list of WordPress Page under tag when is_tag() called
- Meta query with order by another custom field
- Sort Posts by Multiple Meta Values [duplicate]
- orderby:date not working
- WP_Query posts by distance based on LAT & LNG in Database
- Changing WP_Query params with url Query Var
- Sort query_posts for Parent Pages to menue order or the count?
- How to enable sorting in custom media uploader in plugin
- Sort wordpress custom posts based on meta value
- WP_Query order by custom field, then randomly order some of results
- Order a custom post type admin screen by a second custom post type title
- Sort custom post type by multiple custom fields
- Gallery shortcode numerical sorting
- Can’t seem to do combined query AND sort?
- sort query results by newest
- Sort custom post type by most current date picker
- Post filtering is returning blank page
- Sorting search results with custom dropdown
- Sort posts by clicks on download button
- How to manage a particular “order by” for get_search_query()?
- Custom Taxonomy Sort For a Custom Query
- ASC and DESC separately from orderby
- How to sort store location by specific category order in WP store locations
- Sort by price wpdb
- Get authors list and sort them by recent posts
- Listing Cities A custom taxonmy by selection order
- How to sort (orderby) a query done by a template function before the ‘foreach’ loop?
- New custom post type entries are not sorted correctly in admin using pre_get_posts
- Display three sequential posts on each page load, without repeating previous
- How to sort a WP_Query array by post_name after an array_merge();
- Sorting meta box values by start- and enddate and all dates in between
- Sort Posts with custom meta key by default which is currently set as optional
- Archive with specific keyword by category sorted by date
- Sort Search Results in Order of/by Character @ count (9) of post(s) title. (Ocean-WP theme)
- Custom taxonomy with custom meta value is not sorting correctly (query returns the same value for orderby regardless of sort column click)