Is it possible to get a link for a taxonomy as such, not its individual terms? And to which page in the template hierarchy will this link point?
Consider a hierarchical taxonomy called 'products'. Top level terms are 'productgroup1', 'productgroup2' and 'productgroup3'. Now I can get the link of a term like 'productgroup1' (using get_term_link
) and it will be something like http://localhost/products/productgroup1, which will point to taxonomy-products.php
. On this page I will show child terms of the term 'productgroup1' in the taxonomy.
But I also need a page for showing all top-level terms. So I need a page with link http://localhost/products/ on which I will show those top-level terms 'productgroup1', 'productgroup2' and 'productgroup3'. Also, it would be nice if this link would point to the same template taxonomy-products.php
, since most of the code will be the same.
But http://localhost/products/ gives a 404 and a function for getting a link for a taxonomy does not exist? I can only find a function for getting a term's link.