Archived topic
More advanced styling for title text - header
3 replies · Started by Aga on December 27, 2017
Hi! I want to have different font colours for A and B and C in a page title "Przedszkolne ABC". I'm thinking about creating different p classes, adding it to additional CSS, but I do not know how to add them to the text, as <p> and <h> do not work when simply typed in the tittle...
The title option doesn't allow HTML by default.
However, you should be able to do this:
add_filter( 'option_blogname', 'tu_custom_site_title' );
function tu_custom_site_title() {
return 'Przedszkolne <span class="a">A</span><span class="b">B</span><span class="c">C</span>';
}
Hope this helps :)
Thank you very much, it works! I've added the snippet in the header hook, adding <?php (YOUR CODE) ?>, and than customised CSS classes .a, .b, and .c in personalization >> Add custom CSS - hope it is the best way to do it :3
Instead of using hooks, I would use one of these methods: https://docs.generatepress.com/article/adding-php/
Glad I could help! :)