2017-01-12 7 views
1

Ich habe versucht mit WP Hooks auf einem Mini-Thema am Gebäude, aber "Farbe" Attribut hat nicht funktioniert.Wordpress Hook Text Stil "Farbe" funktioniert nicht

<span style="color: #C40000; font-family: 'Roboto', sans-serif; font-size:26px; padding: 5px; line-height: 1; text-decoration: underline; -moz-text-decoration-color: #C40000; text-decoration-color: #C40000;"> 

    <?php echo the_category(''); ?> 
    </span> 
+0

funktioniert für mich - https://jsfiddle.net/7gc1jehp/. ist die Spannweite in einem Anker? Wenn ja, versuchen Sie, die Farbe auf den Anker – Pete

+0

derzeit als statischen Text zu sehen. Es würde funktionieren, wenn der Text statisch ist, aber wenn es dynamisch ist (wp hook), wird es nicht funktionieren und ich möchte wissen, ob es ein Update gibt, das die Art ändert, wie es funktioniert. – smith

Antwort

0

in Ihrer CSS-Datei Klasse mit Ihrer Kategorie Stil

.category-style{ 
    color: #C40000; 
    font-family: 'Roboto', sans-serif; 
    font-size:26px; 
    padding: 5px; 
    line-height: 1; 
    text-decoration: underline; 
    -moz-text-decoration-color: #C40000; 
     text-decoration-color: #C40000; 
} 

nächste Filter erstellen, können Sie es in functions.php platzieren

<?php 

    add_filter('the_category','category_style', 10, 3); 

    function category_style($thelist, $separator, $parents){ 

     $class_to_add = 'category-style'; 

     return str_replace('<a href="', '<a class="' . $class_to_add . '" href="', $thelist); 
    } 

?> 

und letzte Anzeige Kategorie in Ihrem Datei.

<?php echo the_category(''); ?>