Reputation: 351
Sorry about that but I can't figure out what's wrong with my code.
I am trying to sort my posts from category #3 alphabetically but I think I'm doing it wrong.
<?php
$catquery = new WP_Query( 'cat=3' );
while($catquery->have_posts()) : $catquery->the_post('&orderby=title&order=ASC');
?>
Upvotes: 1
Views: 1275
Reputation: 1963
try sort from query itself
$args = [
'order' => 'ASC',
'orderby' => 'title',
];
$query = new WP_Query($args);
Upvotes: 1
Reputation: 4382
Try this:
<?php
$args = array(
'posts_per_page' => -1,
'cat' => 3
'orderby' => 'title',
'order' => 'DESC'
);
$catquery = new WP_Query($args);
while($catquery->have_posts()) : $catquery->the_post();
?>
Hope help you.
Upvotes: 1