I am using the following but my posts are still in Chronological Order (Oldest to New). My target is to have latest post on the top. (Newest to Old)
$catquery = new WP_Query( array (
'cat'=>'27',
'post_type'=>'news',
'orderby' => "post_date",
'order' => "DESC" )
);
while($catquery->have_posts()) : $catquery->the_post();
<p class="date"> <?php the_date(); ?> </p>
<h3><?php the_title(); ?></h3>
<p> <?php the_content('Read More', FALSE); ?>
I have also tried orderby' => "date"
but no luck. How to solve this?
Your code is close, but there are a few problems.
'cat'
expects an int not a string so you need'cat'=>27,
post_date
you needdate
ASC
ifDESC
doesn’t work.Here’s the new query:
Here’s a reference: WP_Query