Skip Navigation

[Resolved] Archive page title should be name of post type, not “Archive”

This thread is resolved. Here is a description of the problem and solution.

Problem: I am using the Roam theme. My WordPress Archives are displaying content, but the title of each archive page is "Archive". I would like to display the name of the post type instead, but I cannot change it in the WordPress Archive.

Solution: If you want to modify the title of any archive, it looks like you can register your own filter in the archive PHP file corresponding to that archive, and add any arbitrary text. For example, if you have a custom post type with the slug "job-opening", then you will copy the archive.php file from the parent roam directory into your child theme directory and change the name to archive-job-opening.php. Just before the line get_header();, insert your filter like this:

...
add_filter('roam_mikado_title_text', function($title){
  return 'Your custom Job Openings archive title';
}, 10);
 
get_header();
...

Relevant Documentation:
https://developer.wordpress.org/themes/basics/template-hierarchy/

This support ticket is created 5 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by Elsie 5 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1212673

Tell us what you are trying to do? I am not having luck with showing correct page titles when using any of your plugins. This issue is with Layouts. It shows my page title as "Archives". I want it to say the name of the post type, which is Employment Opportunities.

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site? hidden link (password is rcpcc)

#1212783

Hi, in general Layouts and Content Templates can be used to design the main content area of the site, which corresponds to a WordPress function "the_content()". Most themes do not include archive titles in that area, so they are included by the theme's PHP files in a way that Toolset cannot control. Some themes provide options that allow you to disable these archive titles completely. If that's an option, you could create your own titles within the Toolset templates. You could also use custom CSS to hide their titles and display your own instead. You could also create a custom PHP archive template file based on your parent theme's archives.php file, and replace the title as needed.

I'm not familiar with the Roam theme, but I'll be glad to take a quick look if you can provide a zip archive of the theme files. You can post that zip to any downloading service and provide a download link in the private reply fields here. Any URL will be fine.

#1214211

It works, thanks. If you want to modify the title of any archive, it looks like you can register your own filter in the archive PHP file corresponding to that archive, and add any arbitrary text. For example, if you have a custom post type with the slug "job-opening", then you will copy the archive.php file from the parent roam directory into your child theme directory and change the name to archive-job-opening.php (see WordPress template hierarchy link below for more information about this naming convention). Just before the line get_header();, insert your filter like this:

...
add_filter('roam_mikado_title_text', function($title){
  return 'Your custom Job Openings archive title';
}, 10);

get_header();
...

Repeat this process for each custom post type and taxonomy archive.

#1214671

Thank you SO much! That worked perfectly. I really appreciate your help with this.