I am trying to add a dropdown to sort my custom posts.
I have tried the solutions here - <a href="http://ak.net84.net/php/filter-dropdown-for-wordpress/" rel="nofollow">http://ak.net84.net/php/filter-dropdown-for-wordpress/</a> - and here - <a href="http://blog.rutwick.com/use-jquery-to-reorder-your-wp-posts-on-the-fly" rel="nofollow">http://blog.rutwick.com/use-jquery-to-reorder-your-wp-posts-on-the-fly</a>
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 - <a href="http://digwp.com/category/admin/?orderby=title&order=DESC" rel="nofollow">http://digwp.com/category/admin/?orderby=title&order=DESC</a> 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.
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.
I have tried the solutions here - <a href="http://ak.net84.net/php/filter-dropdown-for-wordpress/" rel="nofollow">http://ak.net84.net/php/filter-dropdown-for-wordpress/</a> - and here - <a href="http://blog.rutwick.com/use-jquery-to-reorder-your-wp-posts-on-the-fly" rel="nofollow">http://blog.rutwick.com/use-jquery-to-reorder-your-wp-posts-on-the-fly</a>
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 - <a href="http://digwp.com/category/admin/?orderby=title&order=DESC" rel="nofollow">http://digwp.com/category/admin/?orderby=title&order=DESC</a> 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.
Code:
<?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.