How do I change the order (ASC and DESC) in the following retrieval method using WP_Query?

The following code retrieves only custom post types with the custom taxonomy “Slider.”

I would like to change their order to ASC.

Read More

The code:

<?php // Retrive custom post type with a custom taxonomy assigned to it
 $posts = new WP_Query('post_type=page_content&page_sections=Slider (Front Page)') ?>
 <?php while ( $posts->have_posts() ) : $posts->the_post(); ?>
 <?php the_content(); ?>
<?php endwhile; ?>
<?php wp_reset_query(); ?>

Not sure if I should use an array (not sure how anyways).

Any suggestions?

Related posts

Leave a Reply

2 comments

  1. just change this line in your code:

     $posts = new WP_Query('post_type=page_content&page_sections=Slider (Front Page)') ?>
    

    to this:

     $posts = new WP_Query('post_type=page_content&page_sections=Slider (Front Page)&order=ASC') ?>
    

    Basically it adds the order parameter witch can take two values (ASC,DESC).

    hope this helps.