0

I have setup a Custom Post Type called 'Sports Clubs'. These use tags. I need a page to display a list of posts associated with the various tags.

I'm currently doing this for standard posts via the template 'tag.php'. An example URL is www.website.com/tag/tag-name/ This works great for standard posts. But its not working for the custom post types. I would assume the output page would be something like www.website.com/sports-clubs/tag-name/

I've tried adding templates 'tag-sports-clubs.php' and 'taxonomy-sports-clubs_tag.php' with no joy. The tags strangely link to my index.php page which is being used for search results.

1
  • take a look at pre_get_posts to change the value of the post_type parameter on the main query for that archive. There's no special version of the tag archive/URL/template just for that CPT
    – Tom J Nowell
    Oct 4, 2023 at 13:26

1 Answer 1

0

After a bit of trial and error I found a solution. I needed to create a template called 'taxonomy-sports-clubs.php'. This contains a loop listing all the posts for specific tags.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.