WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to display archive pages of posts based on their taxonomies, and an archive page of a term in that taxonomy??

For example, i have a site about beauty products, and i write a product review as a post. I want to put it in the 'hair' category, and in the taxonomy 'shampoo', with the term 'dry'. I have managed to create an archive page for all posts within the 'hair' category, but i cant figure out how i then create a page to show all products that are in 'hair' AND with a taxonomy of 'shampoo'. I would also need a further page showing all products in 'hair' AND 'shampoo' AND 'dry'. ie. mysite/hair/shampoo/dry where hair is the category, shampoo is the taxonomy, and dry is the term.

Am i on the right track in thinking i need to create a taxonomy-shampoo.php page? Any help would be greatly appreciated. Thanks, Patrick.

share|improve this question

The Template Hierarchy Codex entry is your friend.

  • Archive page for category hair: category-hair.php
  • Archive page for taxonomy shampoo: taxonomy-shampoo.php
  • Archive page for taxonomy shampoo term dry: taxonomy-shampoo-dry.php

To display some cross-query between different taxonomies, such as category and a custom taxonomy, such as hair, you'll need to do a custom query, and display it on your own custom page template, or something similar.

share|improve this answer

Is it possible to display archive pages of posts based on their taxonomies,

Yes.

and an archive page of a term in that taxonomy??

Yes, as that's exactly the way it's done IIRC.

In case you can't do that with what's in out-of-the box, you can always do a custom query (Wordpress Codex) in conjunction with overriding your theme either in the theme loader or by registering something within the Permalink/URL space.

share|improve this answer

Check it, WordPress supports templates for taxonomy archives, both for the taxonomy itself and its individual terms, out of the box: http://codex.wordpress.org/File:Template_Hierarchy.png

But unfortunately, I don't know how to make a taxonomy for a taxonomy (categories are simply a kind of taxonomy, a default kind). All taxonomies exist unto themselves, in separate permalink structures.

Looking at your example, I want to know, why not just make "shampoo" a sub-category of "hair?" Then you'd get your URL of mysite/categories/hair/shampoo/dry.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.
{"cc_re__cc_re__cc_by_sa_3_0": ["                    <li><a href=\"//area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2016 Stack Exchange Inc; user contributions licensed under <a href=\"https://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \r\n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2016.5.27.3620\r\n            </div>\r\n                <div id=\"additional-notices\">\r\n                    WordPress is a trademark of the WordPress Foundation, registered in the US and other countries. This site is not affiliated with the WordPress Foundation in any way.\r\n         "], "copyright__copyright__copyright": ["rchy.png\n\nBut unfortunately, I don't know how to make a taxonomy for a taxonomy (categories are simply a kind of taxonomy, a default kind). All taxonomies exist unto themselves, in separate permalink structures.\n\nLooking at your example, I want to know, why not just make \"shampoo\" a sub-category of \"hair?\" Then you'd get your URL of mysite/categories/hair/shampoo/dry.\n\nshare|improve this answer\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service."]}