[Resolved] More advanced styling for title text – header

Home Forums Support [Resolved] More advanced styling for title text – header

Home Forums Support More advanced styling for title text – header

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #457725
    Aga

    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…

    #457962
    Tom
    Lead Developer
    Lead Developer

    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 ๐Ÿ™‚

    #458321
    Aga

    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

    #458638
    Tom
    Lead Developer
    Lead Developer

    Instead of using hooks, I would use one of these methods: https://docs.generatepress.com/article/adding-php/

    Glad I could help! ๐Ÿ™‚

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.