WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

I would like to change their order to ASC.

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?

share|improve this question
up vote 0 down vote accepted

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.

share|improve this answer

Which order you want to achieve? Chronological? Alphabetical?

In any case see Order & Orderby Parameters in Codex for available arguments.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.