I'm trying to show the latest posts using the get_query_var
function. The function filters the posts according to their category.
When I'm displaying the posts on the page they appear unsorted although I've added the
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args=array(
'category__in'=>array( $cat),
'order' => ASC,
'caller_get_posts' => 1,
'paged'=>$paged,
'orderby' => date,
);
query_posts($args);
How can I sort properly?
paged
parameter to control paging, but that should have no effect on sorting. This should be done by theorder
andorderby
parameters (and even if you leave it out, ordering by date is the default). Are you sure no other query is running before you display the posts? Can you give the code up and including thehave_posts()
and related lines? In what file did you place this code?query_posts()
. Maybe another plugin? Have you tried disabling all plugins, to see whether one of them hooks into the query and changes settings? Is the order always different (random)? Or is it by ID, by title, ...? Is this an on-line example that we can access?