- This topic has 16 replies, 3 voices, and was last updated 2 years, 10 months ago by
Fernando.
-
AuthorPosts
-
December 10, 2022 at 3:59 am #2456829
ANGELA
Hi,
I am using the “Aroma” template from the GeneratePress site library, which uses the navigation as a header. Because my site title is too long, I would like to display it in two lines. Could you please tell me how I can make it possible?
Thanks so much for your help
AngelaDecember 10, 2022 at 5:16 am #2456897David
StaffCustomer SupportHi there,
so the Site Title field in WP customizer won’t support HTML or line breaks.
You will need to use a PHP Snippet like this:add_filter( 'generate_site_title_output', function( $output ) { $titleHTML = '<span class="line-one">Line one</span><span class="line-two">line two</span>'; return sprintf( '<%1$s class="main-title" itemprop="headline"> <a href="%2$s">%3$s</a> </%1$s>', ( is_front_page() && is_home() ) ? 'h1' : 'p', esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ), $titleHTML ); });
On this line :
$titleHTML = '<span class="line-one">Line one</span><span class="line-two">line two</span>';
You need to change the text between the span tags for your title.How to add PHP: https://docs.generatepress.com/article/adding-php/
Then add a little CSS to stack them:
.main-title span { display: block; }
December 15, 2022 at 12:56 am #2462454ANGELA
Thanks so much; I will try to do it!
December 15, 2022 at 3:38 am #2462587ANGELA
Hi David,
I added the snippet and the CSS code, but unfortunately, it is not working.
ThanksDecember 15, 2022 at 4:23 am #2462643David
StaffCustomer SupportCan i see the site ?
December 15, 2022 at 1:11 pm #2463379ANGELA
Yes, sure: https://muju.website/
December 15, 2022 at 5:32 pm #2463527Fernando Customer Support
Hi Angela,
That’s odd. May we know how you specifically added the PHP snippet?
December 15, 2022 at 6:39 pm #2463562ANGELA
Hi Fernando,
Here are two screenshots of the snippet and the CSS.https://muju.website/wp-content/uploads/2022/12/Screenshot-2022-12-16-at-9.33.14-AM.png
https://muju.website/wp-content/uploads/2022/12/Screenshot-2022-12-16-at-9.35.55-AM.pngThanks a lot!
December 15, 2022 at 7:13 pm #2463573Fernando Customer Support
I see. Viewing your screenshot, it’s showing that the Snippet is currently not activated. Can you activate it first?
December 15, 2022 at 7:16 pm #2463575ANGELA
Oh, I see…
I just activated it!December 15, 2022 at 7:23 pm #2463580Fernando Customer Support
Great! Let us know how it goes.
December 15, 2022 at 7:47 pm #2463592ANGELA
Hi,
It doesn’t look good: https://muju.website/
ThanksDecember 15, 2022 at 8:04 pm #2463594Fernando Customer Support
I see. Can you update the CSS code provided previously to this one?:
.main-title span { display: block; line-height: 1.2; text-align:center; }
Let us know how it goes.
December 15, 2022 at 8:44 pm #2463611ANGELA
Hi,
That worked perfectly!
Is it possible to display it also in the center on mobile? now it looked like this:
https://muju.website/wp-content/uploads/2022/12/WhatsApp-Image-2022-12-16-at-11.41.40.jpeg
Thank youDecember 15, 2022 at 9:20 pm #2463616Fernando Customer Support
Yes, it’s possible.
Can you try adding this CSS?:
.inside-navigation .navigation-branding { justify-content: center; }
Let us know how it goes.
-
AuthorPosts
- You must be logged in to reply to this topic.