Site logo

[Support request] Is there a way to replace the site tile with the curent post title in the header

Home Forums Support [Support request] Is there a way to replace the site tile with the curent post title in the header

Home Forums Support Is there a way to replace the site tile with the curent post title in the header

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2543042
    Leonard

    I just bought into GP Premium and am building my first site with it.

    http://reg.leon-arts.de/jury/

    I was wondering if it is possible to have the post title displayed in the header. And so replacing the site title.

    Using the customizer, I couldn’t find a way to do this.

    I am on the latest version of the Theme and Plugin.

    #2543216
    Ying
    Staff
    Customer Support

    Hi Leonard,

    I don’t think it’s a good idea, as then you will have many site titles, it’s not great for SEO, and might get the bot confused.

    But if you insist, you can try this PHP snippet:

    add_filter( 'generate_site_title_output', function( $output ) {
    	return sprintf(
    		'<%1$s class="main-title" itemprop="headline">
    		    %3$s
    		</%1$s>',
    		( is_front_page() && is_home() ) ? 'h1' : 'p',
    		esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ),
    		get_the_title()
    	);
    });
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.