Support » Plugin: KIA Subtitle » Make it show up in SEO titles (Yoast's plugin)

  • Resolved thatwastaxing

    (@thatwastaxing)


    Hi,

    Thanks for the plugin! It works great on my site.

    I am trying to figure out a way to get my subtitle in the SEO title that Yoast’s plugin generates.

    A template variable available is %%cf_<custom-field-name>%% Replaced with a posts custom field value

    Could I use this variable and fill it with the subtitle?

    Thanks!

    http://wordpress.org/extend/plugins/kia-subtitle/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author helgatheviking

    (@helgatheviking)

    You’re welcome. I’m glad you like it. I’m not sure I understand what you mean with your custom field name… the sub title is already stored in a meta field. You can retrieve the subtitle information with the get_the_subtitle() function. I believe that Yoast’s SEO plugin filters wp_title(). So you could also filter wp_title() and pass in the value from the subtitle field.

    Just as a suggestion, you could perhaps try:

    function kia_add_subtitle_to_yoast($title){
    global;
    $subtitle = get_the_subtitle( $post->ID );
    if($subtitle){
       $title .= " - " . $subtitle;
    }
    return $title;
    }
    add_filter('wp_title','kia_add_subtitle_to_yoast', 99 );

    It is totally untested, but might work. Unfortunately I can’t really support the SEO plugin. Best of luck.

    Thanks for the code. I ended up manually adding the subtitle to each post anyway since sometimes the subtitle was too long for Yoast’s SEO title character limit.

    Plugin Author helgatheviking

    (@helgatheviking)

    good point. seo titles in google have a character limit. for pure SEO purposes it is best to cusomtize the title manually.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Make it show up in SEO titles (Yoast's plugin)’ is closed to new replies.