- This topic has 9 replies, 2 voices, and was last updated 3 years, 4 months ago by
David.
-
AuthorPosts
-
December 18, 2022 at 2:43 am #2465760
Nicolas
This is the layout of my site header: https://snipboard.io/oNuWGV.jpg
I Only the “circle and fist” is an image. For the rest, I’m using the default text option provided by GP.
How can I get the 2 letter “de” in black while keeping “sports” “combats.org” in red?Thanks
December 18, 2022 at 5:46 am #2465884David
StaffCustomer SupportHi there,
it would require some PHP to add the main-title to include the necessary HTML to style it like that.
1. Add this PHP Snippet:
add_filter( 'generate_site_title_output', function( $output ) { $titleHTML = 'sports<span class="accent-one">de</span>combat.org'; 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 ); });How to add PHP: https://docs.generatepress.com/article/adding-php/
This wraps the string
dein a span tag with class ofaccent-one.2. You can then add some CSS to style it different eg.
.main-title .accent-one { color: black; }December 23, 2022 at 3:34 am #2471358Nicolas
Thank you David.
As you can see on the URL shared in the Private Info, it works for the page title next to the logo.
But it does not replicate on the [sitename] used on this Elements.
December 23, 2022 at 3:55 am #2471377David
StaffCustomer SupportIs that
[sitename]shortcode a custom PHP snippet ?
Can i see it ?December 24, 2022 at 6:03 am #2472292Nicolas
Hello,
It comes from this extension.
Note: I’m not a coder myself.December 24, 2022 at 6:51 am #2472323David
StaffCustomer SupportUnfortunately i can’t assist with that, as i am not sure how it returns it site title.
Why not remove the shorcode and manually add the title there ?
Then you can use the Highlight option in the Blocks Toolbar to set a different color.December 24, 2022 at 7:14 am #2472339Nicolas
Why not remove the shorcode and manually add the title there ?
I just did this but how can I get “de” in black in “sport de combat” (that is all in red)?
December 24, 2022 at 7:41 am #2472364David
StaffCustomer SupportHighlight the 2
dewith your mouse, and in the block toolbars drop down menu you can select Highlight and set it to a different color.December 25, 2022 at 1:21 am #2472742Nicolas
David, you taught me something.
Merry X-mas.December 26, 2022 at 3:58 am #2473526David
StaffCustomer SupportGlad to be of help and Merry Christmas !
-
AuthorPosts
- You must be logged in to reply to this topic.