Ho creato un custom content type “atleti” per gestire le schede degli atleti di un team di rugby, ho modificato la pagina archive-atleti.php in modo da visualizzare le immagini di tutti gli atleti; ogni immagine rimanda alla scheda del rispettivo atleta.
Essendo gli atleti una trentina ho dovuto metter mano al file functions.php in modo da modificare il numero di post visibili nella pagina archivio degli atleti (impostato di default a 5), la modifica che ho fatto cosà¬:
function custom_per_page(&$query) {
if (is_post_type_archive('atleti')) {
$query->set('posts_per_page', 30);
}
return;
}
La modifica sembra funzionare, in effetti nella pagina archive-atleti.php vedo tutte le miniature degli atleti, tuttavia nella sidebar (solo in questa pagina) la lista dei post recenti anzichè visualizzarmi gli ultimi 5 (come impostato nel widget) mi visualizza la lista degli ultimi 30, come se la modifica fatta in function.php avesse agito anche sulla collona “articoli recenti”.
C’è un modo per impostare separatamente le due cose? (post per pagina) e (numero post recenti nella sidebar) ?