query_posts() won't sort properly
-
Trying to modify a theme with a child theme. There’s something fishy with a query_posts(). I have these arguments which are defaults:
Array ( [post_type] => post [post_status] => publish [category_name] => [posts_per_page] => 4 [offset] => 0 [order] => DESC )i’ve tried with “orderby” => ‘date’ as well. If i change the post_type to ‘products’, for examle, i get the products but not in a date order. the sorting function just does not work no matter what i do.
I’ve tried this as well:
$blog_posts = query_posts($args); foreach($blog_posts as $bp) { echo '<pre>'; print_r($bp->post_date); echo '</pre>'; }and tried all different kind of variations – the sorting does just not work. Going nuts here. Everything excetp sorting is working. Any tips of plugins which messes with my query, or known bugs/problems regarding this?
Or, in this case, something likequery_posts($args); if(have_posts()) { while(have_posts()) { //Reverse this loop?! } }would work as well.
The topic ‘query_posts() won't sort properly’ is closed to new replies.