WordPress.org

Ready to get started?Download WordPress

Forums

Change the sort order of subpage list (1 post)

  1. push
    Member
    Posted 3 years ago #

    I have managed to research, find and modify some code here in the forums to display a list of child-pages with a thumbnail from that page and a description of the page. It has defaulted to ordering it by newest creation date. how do I make this order by oldest creation date first?

    Here is the code I am using:

    <?php
    $child = $post->ID;
    $args=array(
      'post_parent'=> $child,
      'post_type' => 'page',
      'post_status' => 'publish',
      'posts_per_page' => -1,
      'caller_get_posts'=> 1,
      );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      echo '';
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <div id="pp-wrapper">
    <div id="pp-thumb">
    <a href="<?php the_permalink() ?>"><img src="<?php echo get_post_meta($post->ID, 'Featured_Image', true); ?>" width="200px"></a></div>
    <div id="pp-title">
    <a href="<?php the_permalink() ?>"><font color="#333"><?php the_title(); ?></font></a>
    </div>
    <div id="pp-description">
    <?php
        $name = get_post_meta($post->ID, 'Post_Description', true);
        if ($name){
          echo ''.$name .'</div></div>';
        }
    
    endwhile;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>

    I don't know enough about php to decipher the instructions in the codex. The more I modify code the more I learn about its structure and how to write from scratch. But I'm still a noob all things considered.

    Thanks for any help that can be provided.

Topic Closed

This topic has been closed to new replies.

About this Topic