I am trying to add a dropdown to sort my custom posts.
I have tried the solutions here – http://ak.net84.net/php/filter-dropdown-for-wordpress/ – and here – http://blog.rutwick.com/use-jquery-to-reorder-your-wp-posts-on-the-fly
I can’t get either of these to work and I can’t even get my posts to sort by adding this to the end of my URL – ?orderby=title&order=DESC.
Out of curiosity, I went over to DigWP and tried this – http://digwp.com/category/admin/?orderby=title&order=DESC which worked and sorts the posts by title and in descending order.
So I am wondering why it won’t work on my site? Here is the code that is getting my posts.
<?php $my_query = new WP_Query( array(
'post_type' => 'project',
'post_status' => 'publish',
'paged' => get_query_var('paged'),
));
while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
I’m guessing there is something wrong with the query or perhaps wp_query won’t allow ordering posts in this way?
Any help appreciated.
If you want to get the query string variable, i.e.
?orderby=title