Display wordpress posts in ascending order

I am trying to display wordpress posts in ascending instead of descending order.

The code I am using in my template is below

Read More
<?php 

                    $temp = $wp_query;
                    $wp_query = null;
                    $wp_query = new WP_Query();
                    $wp_query->query('showposts=24&post_type=movie&orderby=ASC' . '&paged=' . $paged);

                    while ($wp_query->have_posts()) : $wp_query->the_post();

                 ?>

however this is not working.

Does anyone know why?

Any help would be great
D

Related posts

2 comments

  1. It’s ok but,

    $wp_query->query('showposts=24&post_type=movie&order=ASC' . '&paged=' . $paged);
    

    The difference is: “order”, not “orderby”.

  2. <?php 
    
                    $temp = $wp_query;
                    $wp_query = null;
                    $wp_query = new WP_Query();
                    $wp_query->query('showposts=24&post_type=movie&order=ASC' . '&paged=' . $paged);
    
                    while ($wp_query->have_posts()) : $wp_query->the_post();
    

    Try this. There was just a small mistake that you were trying to order by which is not used with wp_query.

Comments are closed.