Site logo

[Support request] Main-title in 2 colors or some bold letters

Home Forums Support [Support request] Main-title in 2 colors or some bold letters

Home Forums Support Main-title in 2 colors or some bold letters

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1578162
    Diego

    Hi,

    I wondered if it is possible, through CSS code, to put the title in two colors or some bold letters.

    I have tried adding tags to the title but have not succeeded so far.

    https://fluentspanish.express

    Thank you.

    #1578402
    David
    Staff
    Customer Support

    Hi there,

    you would need a PHP Snippet to do that:

    add_filter( 'generate_site_title_output', function( $output ) {
        $titleHTML = 'My title <span class="custom-style">with custom style</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
        );
    });

    Simply update the $titleHTML variable with your site title text and custom CSS Class.

    Adding PHP:
    https://docs.generatepress.com/article/adding-php/

    Reference doc:
    https://docs.generatepress.com/article/generate_site_title_output/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.