Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am not sure if this started with the latest upgrade (didn't notice it until yesterday), but the lists are no longer ordering by either asc or dsc. Doesn't matter which I chooose, or which list, they have all stopped ordering alphabetically. (I use orderby=title order=asc)

share|improve this question
add comment

3 Answers 3

While Xufyan's answer will get the job done, it does cause your page loads to run an extra query and you might get some unpredictable behavior. Furthermore, it doesn't get to the root of your issue.

If you're comfortable with PHP, open up your theme's functions.php file and enter this:

add_filter('request', 'order_posts_by_title', 999 );
function order_posts_by_title( $request ) {
    mail('your@email.com', 'WordPress Debugging', print_r($request,1));
}

And load up the offending lists and see what it emails you (be sure to check your spam). If order and orderby are set, you probably have a plugin (or your theme) interfering. If they aren't, you can set your defaults by adding this to your functions.php file or by making it a plugin for use across multiple themes:

add_filter('request', 'order_posts_by_title', 999 );
function order_posts_by_title( $request ) {
    if ( ! isset($request['orderby'] && ! isset($request['order']) ) {
        $request['orderby'] = 'title';
        $request['order'] = 'ASC';
    }
    return $request;
}

Let me know how you make out!

Cheers~

share|improve this answer
    
I'm not sure that either of these answers is related to the fact that these lists are based on the use of the plugin "list category post". Your answers look to be based on just creating a category list page - which is not what I am doing. The plugin creates that page for me and up until now has always sorted alphabetically. Perhaps it is a plugin conflict - but the only new plugin since this happened is related to you tube use - so not sure why that would cause an issue. –  rweiss Jan 25 '12 at 17:35
    
My suggested code was to help you debug what the issue might be. But, you're right, I didn't address the plugin specifically so that made it a confusing answer; sorry for my lack of clarity. I installed this plugin on a clean system and it works great for me using the latest version of both WP and the plugin and using the shortcode [catlist id="1" order="asc" orderby="title"]. Since it's working perfect for me on a clean system, it's most likely that another plugin or your theme is interfering. If you run my first code block, it should give you a clue if that's the case! –  Matthew Boynes Jan 25 '12 at 17:58
    
I get you now. Yes, it appears my dear clients have been messing with categories and now have some kind of duplicate mess going on. At least according to the email I got. –  rweiss Jan 25 '12 at 19:38
add comment

you can use query_post in order to order the list according to your requirement,

have a look,

global $query_string;
query_posts( $query_string . '&order=ASC' );

If you must use query_posts(), make sure you call wp_reset_query() after you're done.

to know more about query_post, have a look here,

http://codex.wordpress.org/Function_Reference/query_posts

share|improve this answer
add comment

Found the issue. The plugin Post Types Order has an option that must be checked for it to work in Custom Posts. But that option - when on - overtakes the ordering process.

So, it was a plugin conflict, and I have to choose between one or the other.

Thanks for the help.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.