I'm trying to achieve this permalink structure:
- Page "about-us"
- Page "stories"
- Post (story CPT) "post-title"
- Page "stories"
The page "stories" is a custom page template that shows archive for custom post type "story", it needs to be a page template so I can edit the content, and should also have pagination for posts.
So domain.com/about-us/stories/ should show "story" CPT archive with pagination and domain.com/about-us/stories/story-title/ should show a single story.
I seem to get either the archive page pagination, or the post permalink to work, but not both.
If I set my CPT rewrite like
'rewrite' => array(
'slug' => __('about-us/stories', 'text-domain'),
'with_front' => false,
'pages' => true,
'feeds' => false,
)
The post permalink works just as expected, and I can follow a link to domain.com/about-us/stories/story-title/ and that's all fine, but the pagination on domain.com/about-us/stories/ won't work and gives a 404 error when changing page. If I set my CPT rewrite like
'rewrite' => array(
'slug' => __('stories', 'text-domain'),
'with_front' => false,
'pages' => true,
'feeds' => false,
)
the pagination on archive page works, but the post permalinks are now domain.com/stories/story-title and not domain.com/about-us/stories/story-title/
I also tried playing with add_rewrite_tag
and add_rewrite_rule
but can't seem to work my way around this problem. Is this permalink structure possible or should do I just need to settle for different url structure for single posts?