0

I have researched the heck out of this so forgive if I missed the answer somewhere...

I have registered a custom post type 'audiotalk'. Each talk can have one or more teachers so I registered a custom taxonomy for audiotalk called 'teacher' (non-heirachical).

I have an archive and single template for each audiotalk. I would like to find out if I can create an archive and single template for each teacher, with photo (I am using a plugin that associates an image with a taxonomy), description ($term->description) and that's pretty much it. The archive would simply be a list of teachers with links to their single page.

I've tried creating a single-teacher.php template but it's not working, meaning I am linking to, for example https://my.bodhitree.com/teacher/doreen-virtue/ and it's not using that template. In fact that page doesn't exist and I'm not sure why.

Can anybody enlighten me about what to do next?

  • did you do a permalink flush? taxonomy would likely be a page called category-teacher.php if that is your category name. needs to be specific to your name exactly though so make sure it's not just "teacher" – rudtek Dec 31 '16 at 1:00
  • The permalinks flush got me part of the way there, thanks for that. Now something different that was broken is now working. – semidivine Dec 31 '16 at 2:17
  • @rudtek unfortunately the 'teacher' taxonomy is only half working. I have a taxonomy-teacher.php template which is now working as a teacher archive, but single teacher pages are not working. single-teacher.php is not the trick, or my code is wrong. – semidivine Dec 31 '16 at 2:24
  • There is no single-teacher.php template, that is for custom post types, not taxonomies. Taxonomies are used to group posts, so they only have archives for each term in the taxonomy. – Milo Dec 31 '16 at 3:00
  • Thanks @Milo that clears things up. I'm going to have to get creative to do what I need to do. – semidivine Dec 31 '16 at 21:37
0

You can achieve it using archive page in this case taxonomy-teacher.php

That page will return all the terms so you need to use "get_queried_object()" which will only show the data of that particular post.

Hope this answers the question.

  • Thanks @Faisal for your response. You are totally correct! But I had actually solved the issue in the comments (same solution as yours) so I couldn't mark it as resolved. I'll mark your answer as correct to put this to bed. Cheers! – semidivine May 27 '18 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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