• Hi,
    I am working on a custom theme, I have page with slug ‘faq’ and a custom post type that rewrites to slug ‘faq’ so any new post will be listed under ‘faq’. There are few categories for faqs and I wanted to list all categories on faq page in a way that if I visit page it will show default category. And all links should be in site.com/faq/category-name format and if you select the link it will show category from that particular category.

    Right now generating category links just creates links as site.com/category/category-name and if I click on it it fails to load custom post type. I have to explicitly add url query to get custom post type. Another thing I can work with is use url queries to list posts as site.com/faq/?category_name=common-questions but I am not sure which one is beneficial for SEO.

Viewing 1 replies (of 1 total)
  • It seems that all you need is a taxonomy instead of a custom post type or a combination of both.

    If you register a taxonomy called faq and create a template taxonomy-faq.php, the query on that template would loop through all the posts from current taxonomy term. In other words, under the url site.com/faq/common-questions you would get all the posts with a term ‘common-questions’ from taxonomy ‘faq’ attached.

    To show a list of faq categories with that approach you would have to use get_terms() function.

Viewing 1 replies (of 1 total)
  • The topic ‘Category links for Custom Post types’ is closed to new replies.