Created
May 20, 2019 00:25
-
-
Save dospuntocero/24b96fdef4c1064914c16e74dc7c373c to your computer and use it in GitHub Desktop.
order wordpress posts using url variables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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