Changing Wordpress post order with URL string

admin

Administrator
Staff member
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&amp;order=DESC.

Out of curiosity, I went over to DigWP and tried this - <a href="http://digwp.com/category/admin/?orderby=title&amp;order=DESC" rel="nofollow">http://digwp.com/category/admin/?orderby=title&amp;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:
&lt;?php   $my_query = new WP_Query( array( 
                        'post_type' =&gt; 'project',
                        'post_status' =&gt; 'publish',
                        'paged' =&gt; get_query_var('paged'),
                        ));      
                while ( $my_query-&gt;have_posts() ) : $my_query-&gt;the_post(); ?&gt;

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.