[Resolved] Change Main-Title (within header) Without Changing Site-Title

Home Forums Support Change Main-Title (within header) Without Changing Site-Title

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1131275
    Toby

    Hey support,

    Is it possible to change the main-title text that appears within the header without adjusting the site-title?

    A workaround would be a using an image as the logo but I like the styling of the default text that comes with the Arctic theme.

    This change would be site wide.

    Thanks,

    Toby

    #1131406
    David
    Staff
    Customer Support

    Hi there,

    can you provide a link to your site so i can make sure i provide the correct advice.
    You can edit your original topic and use the Site URL field to share the link privately.

    #1131409
    Toby

    URL added, thanks.

    #1131639
    David
    Staff
    Customer Support

    Create a new Hook Element:
    https://docs.generatepress.com/article/hooks-element-overview/

    Add this HTML to the hook content – change the URL and branding text to suit:

    <div class="navigation-branding">
        <p class="main-title" itemprop="headline">
    	    <a href="https://home_url" rel="home">Add your branding text here</a>
        </p>
    </div>

    Select the inside_navigation hook
    And set Display Rules to entire site.

    Then you can hide the Site Title in Customizer > Site Identity.

    #1132084
    Toby

    Thanks David, it almost looks great!

    I’ve had a play around with the CSS but I can’t get the header quite right.

    The div is sitting above the navigation and not in-line to the left.

    Is there a fix for this?

    Thanks again!

    #1132127
    Toby

    It seems that when removing the site title, it removes some of the positioning.

    It has also affected the display of the mobile menu.

    #1132131
    Toby

    I think that the issue is that when the site title is disabled, it removes the associated CSS to the inside-navigation class.

    This disappears when the site-title is hidden:

    #mobile-header .inside-navigation, .main-navigation.has-branding .inside-navigation, .main-navigation.has-sticky-branding.navigation-stick .inside-navigation {
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
    }
    #1132329
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Instead of going the Element route, I would do this:

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

    That way you can keep the Site Title option active.

    #1132382
    Toby

    Worked a treat, thanks Tom/David!

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