Site logo

Archived topic

CPT Archive - display meta custom and before

3 replies · Started by Mario on January 25, 2019

Viewing posts 1–4 of 4

Hy there,
I build a site (maintenance mode for now) and I am using two CTPs ('slugA' and 'slugB' - created by myself, child-theme functions.php) - they are working. In the next step I created an archive page for each with Elementor - works! But one thing I am not able to achieve - how can I set a custom <title> and a custom <description> (meta) in the header above <body> for each archive? Right now I get the title and the description from the latest post - which of course isn't correct. If I got it right, WordPress creates these pages "on the fly" - if needed. Is there a way to tell (or build a) the template: "Hello, please use this title and this description for this specific Archive-Page!"?
I asked Elementors support, already. The answer was, Elementor haven't such mechanism. Further I have looked at WordPress Template Hierarchy - I can't figure it out by myself, but perhaps there is the way to achieve, what I like to get?
Any ideas or a hint?
Mario

Hi there,

Are you using an SEO plugin like Yoast? If so, they have options for you to adjust the title for custom post types. That would be the easiest way to achieve this.

If not, you would need to filter the default WordPress title using the document_title_parts filter.

Let me know if you need more info :)

Grrreat - thank you, Tom!
Good old wpSEO does the job now.

Awesome :) Glad I could help!

This archived topic is closed to new replies.