• Hello all,

    I am trying to noodle out how to change the sort order of specific category pages.

    Backstory, it’s an art gallery site that is listing art pieces by categories and also wants to use standard blogging features.

    I’m using the Twenty Ten theme as a parent. Child theme with custom CSS, etc…

    I have, in the child theme, a category-6.php and loop-category.php page for customizing category specific pages.

    What I need is to have the category (6 in this instance) sort from oldest to newest. I assume I need to use query_posts() to control the order, but i’m flummoxed on where to put it.

    When I place it in the loop-category.php page it seems I need to filter for the category ID, but this effects all other category pages, (e.g. category-7.php, category-10.php, etc..)

    If I place it in the category-6.php page, I get all kinds of bad mojo happening. I’m hoping to avoid making a loop-category.php for each individual category.

    I’m thinking I need to move the loop code back into the category.6.php page and go from there, but I was hoping to avoid that.

    Thanks

    cheers c-

Viewing 3 replies - 1 through 3 (of 3 total)
  • You could try placing the custom query within a conditional just before the main Loop in loop-category.php – eg:

    <?php if( is_category('6') ) query_posts( ... );?>

    Thread Starter shakergeek

    (@shakergeek)

    I will give that a shot and report back.

    Thanks, that is the fastest reply from a forum ever!

    cheers c-

    Thread Starter shakergeek

    (@shakergeek)

    This gave me a list of all posts:

    <?php if (is_category(6)) query_posts($query_string . '&orderby=date&order=DESC'); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sort order of category specific pages in Twenty Ten’ is closed to new replies.