- This topic has 5 replies, 2 voices, and was last updated 3 years, 11 months ago by
Tom.
-
AuthorPosts
-
April 5, 2019 at 5:03 pm #861005
Henry
Hi, I created custom taxonomy using WordPress Pods, which works great.
However, I notice that if you visit the root of that custom taxonomy there is an error 404, i.e. there is no archive.
My custom taxonomy is ‘US States’ for, (hardly surprising) data that I’ve placed within US States! So, the actual slug is like this
us-states
According to the WordPress hierarchy, I can create a template called:
taxonomy-us-state.php
however if I upload this to my server it doesn’t load – it continues to throw the Error 404.So, my question is – where do I place this template? Is there a resource you can share to show me how to create custom taxonomy templates? Thanks!
GeneratePress 2.2.2GP Premium 1.7.8April 6, 2019 at 8:46 am #861461Tom
Lead DeveloperLead DeveloperHi there,
Have you tried re-saving your permalinks yet? If not, go to “Settings > Permalinks” and hit the save button. That can sometimes fix this issue.
Let me know ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentApril 6, 2019 at 4:14 pm #861647Henry
thanks Tom, but no joy.
If I apply a standard WordPress category to my Custom Post Type it doesn’t show within the archive page.
If I create and apply a standard WordPress post with the same category that post shows as expected within the archive page.
What’s your hunch how to fix this? Is it a GP thing?
April 7, 2019 at 9:05 am #862128Tom
Lead DeveloperLead DeveloperCustom taxonomies/post types are a WordPress thing. They can be tricky sometimes.
Does this custom taxonomy apply to regular posts, or is there a custom post type?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentApril 7, 2019 at 4:31 pm #862356Henry
Thanks Tom – in fact I fixed it with help from the Pods community. Here’s the code that I used to ‘normalize’ the behavior of WordPress to call in the archive of CPT’s:
add_action( 'pre_get_posts', function ( $q ) { if ( !is_admin() // Only target front end queries && $q->is_main_query() // Only target the main query && $q->is_category() // Only target category archives ) { $q->set( 'post_type', ['post','custom_post_1', 'custom_post_2', 'custom_post_3'] ); } });
^ The above came from Pods: https://docs.pods.io/code-snippets/modifying-pre_get_posts-categories-tags-show-custom-post-types/
April 7, 2019 at 4:44 pm #862367Tom
Lead DeveloperLead DeveloperAwesome! Glad you got it working ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.