WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Archives, Index, Ascending order (4 posts)

  1. eljayesse
    Member
    Posted 4 years ago #

    Hello there,

    is there a way to display an index of all post titles (just the titles) in ascending chronological order (oldest first, newest last) in a separate archive page?

    <?php wp_get_archives('type=postbypost'); ?> this code doesn't do the job, displays post titles in descending order :(

    Thanks a lot for any good news!

  2. Samuel B
    moderator
    Posted 4 years ago #

  3. eljayesse
    Member
    Posted 4 years ago #

    Thanks, Samuel!
    I've found this thread before and modified the code since it is all post titles I wanted to display sorted by date in ascending order:

    <?php wp_get_archives( $args ); ?>
    <?php
    $args = array(
    'type' => 'postbypost',
    'orderby' => 'date',
    'order' => 'ASC'
    ); ?>

    but I doesn't do it...

  4. eljayesse
    Member
    Posted 4 years ago #

    Resolved! Funnily it is DESC order... bo! Thanks!

    <?php query_posts(array('order'=>'DESC','orderby'=>'title','posts_per_page'=>'-1',));
    if (have_posts()) : while (have_posts()) : the_post(); ?>

  5. " title="<?php the_title(); ?>">
    <?php the_title(); ?>
  6. <?php endwhile; ?>
    <?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags