Order custom post type is beign ignored
Question
I have a custom post type "car". I’ve created a loop to show all the titles of that post type. I want to show them alphabetically. But the order is ignored.
<?php
$loop = new WP_Query( array(
'post_type' => 'car',
'orderby' => 'title',
'order' => 'DESC'
)
);
while ( $loop->have_posts() ) : $loop->the_post();
the_title();
endwhile; wp_reset_query();
?>
The order output is the same order of the input. So I’ve added Volkswagen Tiguan first, so that is shown first and not Audi A1 (for example).
0
2 months
0 Answers
18 views
0
Leave an answer
You must login or register to add a new answer .