Archived topic
Display page instead of archive
11 replies · Started by Lee on March 16, 2022
I want to create topic groups for my blog posts; for eg:
- Food
- Energy
- Skills
The url for these posts would be domain.com/food/
I have created a page with the permalink 'food'.
I also have a blog category 'food'.
I have changed permalink structure to be domain.com/category/post
I want to display my page instead of the category archive when user types in domain.com/food/
I have tried the fix here: https://stackoverflow.com/questions/64414771/set-custom-pages-instead-of-category-archive-pages
And it works at replacing archive with page but the styling on the page is messed up and the page no longer pulls in posts via the [wp_show_posts id="xxxx"] shortcode.
Is there an up-to-date solution for this?
Basically I want my urls to look pretty for users:
domain.com/food/post-name
And I want the custom page to act as the top level page for the food category.
Thank you for any assistance.
Hi there,
there is is this method:
https://docs.wpshowposts.com/article/use-static-pages-as-category-archives/
but it requires ALL category archives to be swapped out with the same named static page.
Thank you, David, this got me half way there!
My pages now display as intended and show posts using the wp_show_posts shortcode.
However; when I click the 'read more' or image to go to the actual post, it just takes me back to the same page.
For example:
my post has slug: post-name
My permalink setup is: domain.com/category/postname
The link displays correctly on hover: domain.com/category/post-name/ but when I click it, it takes me to domain.com/category/ - the same page I'm on.
It's like the fix to display category archives as pages is now being applied to all posts too.
Thank you again,
Try: Go to Settings > Permalinks and click Save Changes to rebuild your permalinks.
Thank you again, David.
Unfortunately that didn't fix the problem.
I changed the post permalink structure to: /postname/ instead of /category/postname/ and that worked but of course in the browser bar the url for posts is now: domain.com/postname/
I then switched back to try and update permalinks to domain.com/category/postname/ and the same thing happened as before where, when trying to view the post with url domain.com/category/postname/ the page simply reloads the domain.com/category/
Can you share a link to where I can see the issue ?
I've sent it over privately.
Thanks.
hmmm... yeah, thinking about this I believe this has come up before ... I assume this works if you put the permalinks back to default ie. remove /category prefix?
Yes, it works fine when you do that.
Yeah I don't know a way around that, the Page doesn't have the same structure ( because its a page ). You may find a custom permalink plugin that allows you to rewrite those URLS.
Thank yuo David for your help.
I will roll with it. The page to archive fix will work for now.
You're welcome