Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
order wordpress posts using url variables
//passing variables like ?orderby=title
$my_query = new WP_Query( array(
'post_type' => 'project',
'post_status' => 'publish',
'orderby' => get_query_var('orderby'), // will return orderby query string variable
'order' => 'DESC',
'paged' => get_query_var('paged'),
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.