Support » Plugins » Sorting Results

  • The below code is for sorting of posts within a category and what not. You call it by using ?sort=name&dir=ASC at the end of a category example:

    <?php $sortby = $_GET['sort']; ?>
    <?php $dir = $_GET['dir']; ?>
    $wp_query->query('cat=7&showposts=5&order='.$dir.'&orderby='.$sortby );
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    <?php the_title(); ?>
    <?php endwhile; ?>

    You can see the things that you can order by at ttp:// under the $orderby section.

  • The topic ‘Sorting Results’ is closed to new replies.