[Resolved] site title

Home Forums Support site title

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1441691
    Nikolaj

    when using site title it seems like there’s added a space to the code so that ‘smv’ in the title appears as ‘smv ‘ with extra space in the code;

    This is a problem when I’m adding extra text with a css ::before to the title; It want the following result: smvBrobygger. However it ends up smv brobygger

    http://www.smvbrobygger.dk

    code:
    .main-title a::before {
    content: “smv”;
    }

    How to get rid of the extra space or even better how to add formating to the first 3 letters in the title?

    #1441710
    Tom
    Lead Developer
    Lead Developer

    Instead of using a pseudo selector, I would filter the output of the site title:

    add_filter( 'generate_site_title_output', function() {
        return sprintf(
            '<%1$s class="main-title" itemprop="headline">
                <a href="%2$s" rel="home">
                    <span class="title-prepend">smv</span>%3$s
                </a>
                </%1$s>',
                ( is_front_page() && is_home() ) ? 'h1' : 'p',
                esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ),
                get_bloginfo( 'name' )
        );
    } );

    Then you can format it like this:

    .title-prepend {
        /* whatever */
    }
    #1441722
    Nikolaj

    Thanks – but actually my challenge is that I want the site tile to be: smvbrobygger where smv is added a class to make it bold and yellow; Like <span class=”something”>smv</span>brobygger

    How would that be possible? I can’t see how it should work with the code you sent?

    #1441730
    Nikolaj

    sorry it worked – thanks…

    #1442865
    Tom
    Lead Developer
    Lead Developer
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.