Ipotizziamo di voler mostrare in una certa categoria i post in ordine alfabetico.

Se ad esempio la categoria ha ID 10, dobbiamo creare il file category-10.php, prendendo il contenuto da category.php.

Nel nuovo file category-10.php bisogna cercare il codice di inizio e fine Loop, simile al seguente:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
... ...
... ...
<?php endwhile; else: ?>
<p><?php _e('Spiacente, nessun articolo risponde ai tuoi criteri.'); ?></p>
<?php endif; ?>

e sostituirlo con il seguente:

<?php if ($posts) { ?>
<?php $lastposts = get_posts('order=ASC&orderby=post_title&category=10');
foreach($lastposts as $post) : setup_postdata($post); ?>
... ...
... ...
<?php endforeach; ?>
<?php } else { ?>
<p><?php _e('Spiacente, nessun articolo risponde ai tuoi criteri.'); ?></p>
<?php } ?>

Order: ASC o DESC per avere un ordine crescente o decrescente.
Orderby: post_title per avere l’ordine alfabetico invece che cronologico
Category: ID della categoria (10)