• Resolved zac0cmn

    (@zac0cmn)


    Hi!
    First of all I’d like to thank Sybre Waaijer for this great plugin

    My issue is that I’d like to add my site tagline to all my page titles

    <page_title><separator><site_name><colon><site_tagline>
    ex: Contact Us | Acme Industries : We are the best

    I’ve searched in https://theseoframework.com/docs/api/filters/ and the plugin source code but I couldn’t find what I was looking for

    I would be really grateful if any one could help me out

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hi @zac0cmn,

    This should work for most parts of the plugin:

    add_filter( 'the_seo_framework_pro_add_title', function( $title ) {
    
    	if ( the_seo_framework()->is_real_front_page() )
    		return $title;
    
    	$tagline = get_bloginfo( 'description', 'raw' ) ?: '';
    	if ( $tagline ) {
    		$tagline = sprintf( ' %s %s', the_seo_framework()->get_separator( 'title' ), $tagline );
    	}
    	return $title . $tagline;
    } );
    

    However, the input fields might be a bit “off” when filtering the titles, i.e. showing incorrect values.
    I want to resolve this permanently in the near future. With that, I can’t comment yet on whether this filter will still be in effect by then.

    Cheers 🙂

    Thread Starter zac0cmn

    (@zac0cmn)

    Wow! Thanks for the extremely quick response.
    If its not too much of a bother can you tell me how I can change the second separator to something different?

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi @zac0cmn,

    You can exchange the the_seo_framework()->get_separator( 'title' ) call with anything, like '>', or '|'.

    For example, with '>':

    add_filter( 'the_seo_framework_pro_add_title', function( $title ) {
    
    	if ( the_seo_framework()->is_real_front_page() )
    		return $title;
    
    	$tagline = get_bloginfo( 'description', 'raw' ) ?: '';
    	if ( $tagline ) {
    		$tagline = sprintf( ' %s %s', '>', $tagline );
    	}
    	return $title . $tagline;
    } );

    I hope this helps 🙂

    Thread Starter zac0cmn

    (@zac0cmn)

    Thanks a lot!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add tagline to page title’ is closed to new replies.