Site logo

Archived topic

Override layout for custom post type archive

5 replies · Started by Simone on June 11, 2021

Viewing posts 1–6 of 6

Hi there,

I created a custom post type called client_portfolio. I want to override the default archive template, so I created an archive-client_portfolio.php file in my child theme, as I generally do.

Unfortunately this solution doesn't work with GeneratePress.

Is there a solution?

Thanks,

Simone

Hi there,

when you registered the CPT does the args include: 'has_archive' => true,

Hi David,

yes, it looks like this:

'has_archive' => 'projects',

Thanks,

Simone

Change it to 'has_archive' => true, then by default it will use the archive slug that matches the $post_type ( eg. client_portfolio )

Thank you, that works.

Cheers,

Simone

Glad to be of help.

This archived topic is closed to new replies.