Remove #$queryP->query();
If it is the categories page then you do not need WP_Query() as query_posts($args); can re-sort the existing post set, if I am right without re-doing the query.
<?php
$query='orderby=title&order=DESC';
query_posts($query);
?>
<?php if ( have_posts() ) : ?>
HTH
David
Thanks, but the sorting still does not work. I’ve rewritten the code as follows:
<?php
$query='cat=3&orderby=title&order=DESC';
query_posts($query);
?>
<?php while ( have_posts() ) : the_post(); ?>
The query gets to select the posts in the category, but still the sorting does not work.
Ok,
I have modified one of my downloadable twenty eleven child themes which outputs a page of posts, it uses custom fields and there is a download in the link.
Then grab this code from pastebin and replace all the code in the download file page-category.php
The additional Custom Field is:
ordered
The options: (Default ID)
‘none’,
‘ID’,
‘author’,
‘title’ ,
‘date’ ,
‘modified’,
‘parent’,
‘rand’,
‘comment_count’,
‘menu_order’
I tested this with custom fields:
category = blog (one of my categories)
asc = true
ordered = title
category = blog (one of my categories)
ordered = title
category = blog (one of my categories)
ordered = rand
All worked as expected!
HTH
David
I extended my page of posts to use meta data, you might find the code in the page template handy.
Regards
David