Per impostazione predefinita, WordPress ha una categoria “Non categorizzato” con un post di esempio. Potresti voler nascondere i post nella categoria “Non categorizzato” o nella categoria predefinita se l'hai rinominata.
Istruzioni: Aggiungi il seguente codice al file functions.php del tuo tema WordPress per nascondere i post nella categoria “Non categorizzato” o nella categoria predefinita di WordPress con qualsiasi nome.
<?php
// Hide the display of something if it has the category named "Uncategorized"
if( !in_category( 'Uncategorized' ) ) {
// do something like:
the_category( ', ' );
}
// Hide the display of something if it uses the default category, initially named "Uncategorized"
if( !in_category( 1 ) ) {
// do something like:
the_category( ', ' );
}
?>
Potrebbe interessarti anche elencare alcuni post per ogni categoria.
Commenti Lascia una risposta