Changing title for custom single and archive pages it is coming up as Blog

I am actually having two issues. One is that my page titles for both custom post types I have set up are reading Blog. Not sure how to change it. I have a custom slug set up.

The second problem is my breadcrumbs are also linking back to my Blog page instead of the News Page. When I click on my News item I am having the same problem with title as well. Not sure if this is a setting in the plug in setting that I missed or will I have to make a change to my template files?

Here it is in action: http://dev.rkmechanical.com/news/

  • Tyler Postle

    Hey Melissa,

    Hope you're doing well today and thanks for your question!

    It is likely that your post type is still using the default templates. So you will want to make copies of them and make them specific to your news post type. Assuming that is the post type name?

    So instead of single.php it will be single-news.php and instead of archive.php it will be archive-news.php and then make the necessary changes within the template :slight_smile:

    You will likely find "Blog" inside the archive template and then you can change it to whatever you like.

    Hope this helps Melissa! Let us know if you need further assistance with this.

    All the best,
    Tyler

  • Melissa

    Thanks for your response.

    Well actually the first thing I did was make copies of my default single and archive pages then gave them the names single-news.php and archive-news.php. And I know it is using the new pages since I have made so many changes to them. I just can't find where it is pulling the page title in and why it is saying Blog instead of the name of the Custom Post Type which is News and why the breadcrumb is linking it back to Blog instead of News. I can tell that it is using the proper slug since when I click on News in the main menu that URL reads /news.

    I am completely stumped as to where to look to fix this issue.

    Thanks,
    Melissa :slight_smile:

  • Tyler Postle

    Hey Melissa,

    Thanks for your response!

    In that case, do you mind sending us your FTP and WP login so we can take a look at the templates? :slight_smile:

    You can send that in privately through our contact form.

    Send in:

    Subject: "Attn: Tyler Postle"
    -WordPress admin username
    -WordPress admin password
    -login url
    -FTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant urls

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me :slight_smile:

    https://premium.wpmudev.org/contact/

    Look forward to hearing back Melissa!

    All the best,
    Tyler

  • Tyler Postle

    Hey Melissa,

    Thanks for sending that info in :slight_smile:

    As mentioned in our email conversation, I spoke to one of our coding experts and we got this sorted.

    Here is the code we used:

    if(is_archive('news')){
       $blog_title= __('News','domain');
    }else{
       $blog_title             = esc_html( stripslashes( $ttso->st_blogtitle ) );
    }

    We used that to replace just this:

    $blog_title = esc_html( stripslashes( $ttso->st_blogtitle ) );

    So, if you have another custom post type, you can just add another "if" in there :slight_smile: like this:

    if(is_archive('news')) {
       $blog_title= __('News','domain');
    } if(is_archive('cpt_name')) {
       $blog_title= __('Archive Title','domain');
    } else {
       $blog_title             = esc_html( stripslashes( $ttso->st_blogtitle ) );
    }

    Where "cpt_name" = the custom post type name and where "Archive Title" = the title you want displayed in the page banner :slight_smile:

    I placed the edited file version in your sterling child theme so you can continue to update your theme without risk of losing the changes.

    Hope this helps Melissa!

    Let me know if you need any further assistance here.

    All the best,
    Tyler

  • Melissa

    Tyler,

    Thank you so much. You went above and beyond my expectations. And that is saying a lot after having designed websites for over 25 years. I have dealt with 100's of vendors and have to say this was the best experience I have ever had. I figured if the issue ended up being in my custom template I would be left to figure it out. You amazed me.

    Thanks and all the best to you too!
    Melissa :slight_smile:

  • Melissa

    Hey Tyler,

    With the holidays and colds going around this is the first time I have been able to take a look at what you did.

    I am still having an issue with the second problem I was asking about. When I click on the news item the single-news.php breadcrumb still thinks this is a blog post and links back to the archive.php file instead of the archive-news.php file, see this example:

    http://dev.rkmechanical.com/news/rk-mechanical-declared-one-of-colorados-healthiest-work-places-for-2014-2/

    I am thinking this is an issue with the breadcrumb function. I have looked through the Community posts and found one that may have been the same issue however the person who posted it never followed up.

    I also am having another issue with the code you helped me with. I added the second IF statement for the projects custom post type I set up and now the archive-news.php files is coming up with the projects title instead of the News title.

    Sorry :slight_frown:

    Thanks again for your help.
    Me :slight_smile:

  • Predrag Dubajic

    Hey Mellisa,

    Sorry for the delay on this.

    I have changed the code in your small banner file to this:

    if(is_archive('news') || is_singular('news') ){
       $blog_title= __('News','domain');
    } elseif(is_archive('projects')) {
       $blog_title= __('What We Do','domain');
    }else{
       $blog_title             = esc_html( stripslashes( $ttso->st_blogtitle ) );
    }

    So your titles should be working now.

    Also it seems that the archive-news.php is being called on http://dev.rkmechanical.com/news/ page, I tried adding some code to it and it was showing as intended.

    Let us know if you need more help with this :slight_smile:

    Best regards,
    Philip

  • Melissa

    Hi Phillip,

    I ended up using the Breadcrumb NavXT plug in to resolve the breadcrumb problem I was having. So I have the News pages working perfectly.

    However, I am confused I just looked at the "What We Do" page and the title still says News. The breadcrumb says Projects.

    Also when I click on the project title the single page is reverting back to "Blog".

    Any ideas?

    Thanks so much for all your help.

    Melissa :slight_smile:

  • Tyler Postle

    Hey Melissa,

    Hope you're doing well today!

    I just tried to log back into the FTP you provided for me before; however, it isn't connecting. Would you be able to send over valid FTP credentials? Then I'll take another look at this :slight_smile:

    Here's the template for sending stuff in:

    Send in:

    Subject: "Attn: Tyler Postle"
    -WordPress admin username
    -WordPress admin password
    -login url
    -FTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant urls

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me :slight_smile:

    https://premium.wpmudev.org/contact/

    Look forward to hearing back Melissa.

    Cheers,
    Tyler

  • Predrag Dubajic

    Hey Melissa,

    I have managed to access your server and made the following changes to the code I previously posted, now it looks like this:

    if(is_post_type_archive('news') || is_singular('news') ){
       $blog_title= __('News','domain');
    } elseif(is_post_type_archive('projects') || is_singular('projects')) {
       $blog_title= __('What We Do','domain');
    }else{
       $blog_title             = esc_html( stripslashes( $ttso->st_blogtitle ) );
    }

    It should be working fine now, so please test it and confirm if it's working.

    Best regards,
    Predrag

  • Melissa

    Predrag,

    First off I just have to say you guys are awesome. Thanks for hanging in there with me on this. I thought it would just be a matter of installing and configuring the plugin. I have to admit my programming skills are not that great.

    I have tested it and it is fixed on the archive and single pages, however when I click on the category links and the tag links which are actually Industries and Solutions, the title reverts back to BLOG.

    I did attempt in my limited programming skills to add the following with no luck.

    || is_category('solutions') and
    || is_tag('solutions')

    Sorry I really hate to be a bother.
    Me :slight_frown:

  • Predrag Dubajic

    Hey Melissa,

    Thanks for the kind words, we are glad that we helped you with this :slight_smile:

    Code you added is used to check for the category with the name you want, that's why it didn't work. Those are custom taxonomies you created with your custom post type, so I replaced the code you added with this:
    || is_tax('industries') || is_tax('solutions')
    That should do the trick :slight_smile:

    Best regards,
    Predrag

  • Melissa

    Predrag,

    It did!! Thank you so much!! Now can you tell me if you guys have a plug in that will allow me to add a widget with the Industries as a drop down? And a widget that will allow me to display the most recent posts from the News custom post type on the front page?

    This is the site I am converting from Drupal to Wordpress and I need to maintain as much of the functionality as possible.

    http://rkmi.com/what-we-do - shows the functionality of the What We Do Section
    http://rkmi.com/ - shows the recent News items on the front page I need to duplicate.

    Let me know and I will be buying it ASAP.

    And thanks again for all your help.
    Me :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.