- This topic has 16 replies, 2 voices, and was last updated 3 years, 6 months ago by Tom.
-
AuthorPosts
-
January 13, 2020 at 10:17 pm #1131275Toby
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
January 14, 2020 at 2:05 am #1131406DavidStaffCustomer SupportHi 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.January 14, 2020 at 2:08 am #1131409TobyURL added, thanks.
January 14, 2020 at 6:40 am #1131639DavidStaffCustomer SupportCreate 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.
January 14, 2020 at 9:53 am #1132084TobyThanks 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!
January 14, 2020 at 10:42 am #1132127TobyIt seems that when removing the site title, it removes some of the positioning.
It has also affected the display of the mobile menu.
January 14, 2020 at 10:47 am #1132131TobyI 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; }
January 14, 2020 at 4:06 pm #1132329TomLead DeveloperLead DeveloperHi 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.
January 14, 2020 at 6:04 pm #1132382TobyWorked a treat, thanks Tom/David!
January 15, 2020 at 9:40 am #1133172TomLead DeveloperLead DeveloperGlad we could help! ๐
October 7, 2020 at 8:50 am #1476881MartinHi there.
Is it possible to do something like this with the tagline too?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( '/' ) ) ) ); } );
Thanks.
October 7, 2020 at 9:56 am #1476989TomLead DeveloperLead DeveloperYes, there’s a
generate_site_description_output
filter as well:add_filter( 'generate_site_description_output', function() { return sprintf( '<p class="site-description"%s> Your custom tagline </p>', 'microdata' === generate_get_schema_type() ? ' itemprop="description"' : '' ); } );
October 8, 2020 at 12:00 am #1477842MartinBrilliant. Thank you.
October 8, 2020 at 12:12 am #1477862MartinNot sure why but this generates errors.
add_filter( 'generate_site_description_output', function() { return sprintf( '<p class="site-description"%s> Your custom tagline </p>', 'microdata' === generate_get_schema_type() ? ' itemprop="description"' : '' ); } );
Your PHP code changes were rolled back due to an error on line 48 of file wp-content/themes/WoldsWildlife/functions.php. Please fix and try saving again.
Uncaught Error: Call to undefined function generate_get_schema_type() in wp-content/themes/WoldsWildlife/functions.php:48
Stack trace:
#0 wp-includes/class-wp-hook.php(287): {closure}(‘<p class=”site-…’)
#1 wp-includes/plugin.php(206): WP_Hook->apply_filters(‘<p class=”site-…’, Array)
#2 wp-content/themes/generatepress/inc/structure/header.php(194): apply_filters(‘generate_site_d…’, ‘<p class=”site-…’)
#3 wp-content/themes/generatepress/inc/structure/header.php(71): generate_construct_site_title()
#4 wp-content/themes/generatepress/inc/structure/header.php(32): generate_header_items()
#5 wp-includes/class-wp-hook.php(287): generate_construct_heLine 48 is the line mentioning microdata.
October 8, 2020 at 12:14 am #1477865TomLead DeveloperLead DeveloperMake sure you’re using GeneratePress 3.0 ๐
-
AuthorPosts
- You must be logged in to reply to this topic.