Il codice seguente va aggiunto alla fine del file functions.php. Si raccomanda di fare sempre una copia del file originale
// AGGIUNGE LA CLASSE TAGS AI TAGS DI FINE ARTICOLO // IL COLORE DEL LINK E' NEL CODICE
add_filter('the_tags','gkp_add_class_the_tags');
function gkp_add_class_the_tags( $html ) {
if( preg_match('/<a class="/', $html) == 0 )
$html = str_replace('<a', '<a class="tags" style="color: #333;"', $html);
else
$html = preg_replace('/<a class="(.+)"/', '<a class="tags $1" style="color: #333;', $html);
return $html;
}
il codice
style=”color: #333;”
imposta il colore del testo
ovviamente per funzionare a dovere è necessario intervenire anche nei CSS sotto un esempio
/* TAGS sotto i singoli articoli */
/* IL colore del link NON hover è nel file function.php */
.tags{
margin: 20px 3px 20px 3px;
-webkit-border-radius: 5;
-moz-border-radius: 7;
border-radius: 5px;
/*border-width: 1px;
border-color: #555;*/
/*color: #000;*/
color: #555;
font-size: 12px;
letter-spacing: 2px;
background: #f7f3f3;
padding: 1px 10px 1px 10px;
-webkit-box-shadow: 0px 1px 2px #aaa;
-moz-box-shadow: 0px 1px 2px #aaa;
box-shadow: 0px 1px 2px #aaa;
text-decoration: none;
}
.tags:hover {
/* #ffc07d */
background: #fce19c;
/* background: #FDB9BE; */
text-decoration: none;
color: #FFF;
}
All’interno del file single.php è possibile intervenire in questo modo
sostituire la riga
<?php the_tags(); ?>
con:
<!-- Related TAG // IL colore del link è in function/ gkp_add_class_the_tags -->
<div style="clear: both;">
TAG: <?php $before = ''; $seperator = '';
// blank instead of comma $after = '';
the_tags( $before, $seperator, $after ); ?>
</div>
