Support » Fixing WordPress » Show older posts first

  • Resolved agon024

    (@agon024)


    What I am trying to do is simply show the older posts first in a custom post type.

    Here is my loop:

    `<?php $loop = new WP_Query( array( ‘order=desc’, ‘post_type’ => ‘coaches’) ); ?>
    <?php query_posts(‘order=asc’); ?>
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <li>
    <div class=”medium-12 columns mobCenter”>
    <h2><?php the_title(); ?></h2>
    </div>
    <div class=”medium-12 columns no-pad”>
    <div class=”medium-4 columns coachImg”>
    <img src=”<?php the_field(‘coach_image’); ?>” alt=””>
    </div>
    <div class=”medium-8 columns coachCont”>
    <?php the_excerpt(); ?>
    </div>
    </div>
    </li>
    <?php endwhile; // end of the loop. ?>`

    I dont know if I am using “<?php query_posts(‘order=asc’); ?>” correctly or if I have it in the wrong spot but it still shows the posts in descending order “newest first” I need ascending “oldest first”

    Thanks for your help.

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Show older posts first’ is closed to new replies.