url rewriting – Custom archive URL as a subfolder of the custom post type slug
I have a Custom Post Type called Whatever.
The slug for this CPT is whatever.
By default, I can access the posts archive in the frontend at /whatever and each post at /whatever/post-slug
But I would like to have a landing page for this section, which should be accessed at /whatever.
This would collide with the archive, and hence, I want to move the archive to be accessed at /whatever/results.
I need to have a structure as follows:
/whatever (normal page with a slug set to whatever)
/whatever/results (archive for the whatever custom post type)
/whatever/post-slug (single post inside the whatever custom post type)
When registering the CPT, I can pass as an arg:
'rewrite' => ['slug' => 'whatever', 'with_front' => true],
But here, I need to have a subfolder, and doing:
'rewrite' => ['slug' => 'whatever/result', 'with_front' => true],