Support » Fixing WordPress » Changing my loop order to descending – new to old

  • I’m having a struggle getting my posts to display in descending order. I’ve tried several things to no avail. Any help in troubleshooting this would be incredibly helpful. This is the code that exists within my loop-index.php page. The site in question is

     * Loop for home page.
     * @package WordPress
     * @subpackage themeName
     * @since themeName 1.0
    <?php if (have_posts()) : ?>
    		<?php query_posts($query_string . '&orderby=date&order=DESC'); ?>
            <?php while (have_posts()) : the_post(); ?>
                    <div class="post">
                            <h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                            <?php if(is_single()) : ?>
                                    <?php the_content(); ?>
                            <?php else : ?>
                                    <?php the_excerpt(); ?>
                            <?php endif; ?>
            <?php endwhile; ?>
    <?php endif; ?>
    <?php /* Display navigation to next/previous pages when applicable */ ?>
    <?php if ($wp_query->max_num_pages > 1) : ?>
            <div id="nav-below" class="navigation">
                    <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&larr;</span> Older posts', 'themeName')); ?></div>
                    <div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&rarr;</span>', 'themeName')); ?></div>
            </div><!-- #nav-below -->
    <?php endif; ?>


Viewing 1 replies (of 1 total)
  • <?php query_posts($query_string . '&orderby=date&order=DESC'); ?>

    Sorts the posts by date in descending order,

    So…this must not be the template used. It also may not be necessary as the default sort order for posts is by date, descending.

    What happens if you switch to default theme?

Viewing 1 replies (of 1 total)
  • The topic ‘Changing my loop order to descending – new to old’ is closed to new replies.