WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
[resolved] wp_title fallback if no posts exist (3 posts)

  1. magnumcreative
    Member
    Posted 1 year ago #

    If you have no posts in a custom posttype the page title for the archive page falls back to "blogname | tagline" even if you have set it to be specifically something in the Yoast settings.

    ie: if the posttype is an event type listing and there are no events (or posts yet) the title reverts back to default. So instead of the title saying "Events at My Company" which is set in Yoast it reverts back to "Blog Name } Tagline".

    What I want is the title for the archive page to consistently remain to what I've set it to and wondering if this could be added as an option to "force archives" to retain desired titles regardless of posts being present.

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. magnumcreative
    Member
    Posted 1 year ago #

    This is what I eventually wrote in the head to solve my issue of titles not displaying on custom posttype archive pages.

    <title>
        <?php if (is_post_type_archive('careers')) {
                echo 'Current careers available at '; bloginfo('name'); }
              elseif (is_post_type_archive('seminars')) {
                echo 'Upcoming broker education seminars at '; bloginfo('name'); }
              else { wp_title(''); }
         ?>
      </title>

    Ideally Yoast plugin would force the desired title regardless of a post being present in the custom postttype.

  3. magnumcreative
    Member
    Posted 1 year ago #

    Ironically its the same settings in Yoast, it just won't kick in unless I've published a post in to the custom posttype. The assumption of the call depends on published content, thus I had to customize the head title knowing the client may not having any content published due to the custom posttype being event/date based and they will expire and be deleted.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic