Search code examples
wordpresstaxonomy

How do I make a tag taxonomy page?


I have woocommerce plugin. I created a custom tag taxonomy under products to pick the product ingredients. ( https://pasteboard.co/J2BlgqI.png ). To show them as buttons on the product page ( https://pasteboard.co/J2Bn7FD.jpg ).

Now I want the visitor when they click on the ingredient it shows them an ingredient page information. So, if they click on “Beeswax” it shows them Beeswax information like name, function and etc…

Each time I click on “Beeswax it directs me to a filter page https://pasteboard.co/J31hg2w.png .

How can I make a page for each ingredient?

Is it even doable this way? or is there another way to accomplish this?

please advice…

thanks


Solution

  • Yes you can have custom templates for your taxonomies. The template hierarchy explains everything.

    Custom taxonomies use this template file path:

    1. taxonomy-{taxonomy}-{term}.php – If the taxonomy is sometax, and taxonomy’s term is someterm, WordPress will look for taxonomy-sometax-someterm.php. In the case of post formats, the taxonomy is ‘post_format’ and the terms are ‘post-format-{format}. i.e. taxonomy-post_format-post-format-link.php for the link post format.
    2. taxonomy-{taxonomy}.php – If the taxonomy were sometax, WordPress would look for taxonomy-sometax.php.
    3. taxonomy.php
    4. archive.php
    5. index.php

    Since you haven't created a taxonomy-ingredients.php WordPress uses the next available option and falls back to the generic template.

    You can even create a different template (page) for each of your Ingredient by using the first option above.