• Hi All

    I need some assistance with custom queries for specific categories in WP 2.6. I’ve found that I can create a page for the category itself using the category ID (i.e. category-13.php). I’ve verified that this works. Now I want to change the sort order of posts for a specific category. Here’s how my loop looks in my theme:

    <?php while (have_posts()) : the_post(); // the loop ?>
    
    /* Blah blah */
    
    <?php endwhile; //end one post ?>

    I’ve tried using lines like

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

    before the loop but it seems to not have an affect. Can anyone help? Im at a loss here.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Well, according to the Docs, The_Loop starts with
    if ( have_posts() ) etc. not with the “while…”

    Thread Starter rbernabe

    (@rbernabe)

    I apologize, I didn’t the proper chunk of code. I have a proper loop per the Docs:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
     /* Blah */
    <?php endwhile; //end one post ?>^M
    <?php endif; ?>

    But I still can’t get the query to work properly. Any ideas?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom Query for Specific Category’ is closed to new replies.