0

My problem is the following.

I have a custom post type called "photography" which contains a taxonomy called "photographyCategories", which contains several terms : "outside", "inside", "portrait"...

All these terms content is based on the same outline (a list of pictures and a slider).

I know that if I want to display the archive page of one of these terms I have to create, for example, the file taxonomy-photographyCategories-outside.php. I've done it and it works.

But what I want is ONE template for all these terms. I don't wanna have an "outside" template, an "inside" template and a "portrait" template because they're all the same... They display the same type of content, except the photographies that are different.

I can't find a way to do this...

Is there a solution ?

0

According to template hierarchy you have to create the template

taxonomy-photographyCategories.php
|improve this answer|||||
  • That's what I've done. But this is the template page for my taxonomy "photographyCategories" which displays a list of all the terms. – Valentin Dec 19 '13 at 18:37
  • Why would I rename it ? I want to keep this page, and I wanna create another one which would be a term template. But may be the solution is very simple like... Setting a variable in the URL ? – Valentin Dec 19 '13 at 18:44
  • I think you gave me an beginning of solution. When I click on portrait on my taxonomy archive page taxonomy-photographyCategories.php, it redirects me to this link : wordpress/photographieCategories/portraits/. So as you said, if the portraits template exists, it's used. But can I create a "common" template like photographieTerms.php which would be used ? And within this template I would get a variable in the URL (imagine photographieTerms.php?term=portrait) to know what term has been clicked ? – Valentin Dec 19 '13 at 19:01
  • Please post in the question the code you have in taxonomy-photographyCategories.php and the code you have in one term template because the "common" template you are looking for normally is just taxonomy-photographyCategories.php: when you visit wordpress/photographieCategories/portraits/ that file is used if it exists and if taxonomy-photographyCategories-portraits.php doesn't exists. So, remove the file taxonomy-photographyCategories-portraits.php and use some conditional in taxonomy-photographyCategories.php to appear differently if you are vising a term or not. @Valentin – gmazzap Dec 19 '13 at 19:23
  • Okay I have my answer ! My question was too complicated for this simple solution... Thank you for helping :) – Valentin Dec 19 '13 at 19:25

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.