• Hi. I have the following on my index page to show the most recent posts from two categories. However, instead of ordering the posts by date, it orders them alphabetically. I’ve tried a few things and can’t seem to get the problem fixed. Thanks in advance for your help.


    <p class="greentitle">News</p>
    <p />
    <?php query_posts('cat=1&showposts=1'); ?>
    <?php while(have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <div class="post-info"><h2 class="post-title"><a href="<?php

    the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php

    the_title(); ?>"><?php the_title(); ?></a></h2>
    </div>
    <div class="post-content">
    <?php the_content(); ?>
    <div class="post-info">
    <p class="post-date">Posted on <?php the_time('D j M Y'); ?> <?php

    edit_post_link('(edit this)'); ?></p>
    <?php wp_link_pages(); ?>
    </div>
    <!--
    <?php trackback_rdf(); ?>
    -->
    </div>
    <?php comments_template(); // Get wp-comments.php template ?>
    </div>
    <?php endwhile; ?>
    <p class="greentitle">Articles</p>
    <p />
    <?php query_posts('cat=4&showposts=2'); ?>
    <?php while(have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <div class="post-info"><h2 class="post-title"><a href="<?php

    the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php

    the_title(); ?>"><?php the_title(); ?></a></h2>
    </div>
    <div class="post-content">
    <?php the_content(); ?>
    <div class="post-info">
    <p class="post-date">Posted on <?php the_time('D j M Y'); ?> <?php

    edit_post_link('(edit this)'); ?></p>
    <?php wp_link_pages(); ?>
    </div>
    <!--
    <?php trackback_rdf(); ?>
    -->
    </div>
    <?php comments_template(); // Get wp-comments.php template ?>
    </div>
    <?php endwhile; ?>

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Posts are displaying alphabetically instead of by date’ is closed to new replies.