KIA Subtitle
[resolved] Make it show up in SEO titles (Yoast's plugin) (4 posts)

  1. thatwastaxing
    Posted 3 years ago #


    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?



  2. helgatheviking
    Plugin Author

    Posted 3 years ago #

    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){
    $subtitle = get_the_subtitle( $post->ID );
       $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.

  3. thatwastaxing
    Posted 3 years ago #

    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.

  4. helgatheviking
    Plugin Author

    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • KIA Subtitle
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.