I don’t know why WP themes do not support taxonomy homepages. I mean there should be a separate template for example.com/location/
(this may show a list of available taxonomy terms etc.) in addition to example.com/location/newyork/
where location is a taxonomy.
What is the best way to have a taxonomy home? A page with slug=location and custom template?
The /location page doesn’t exist because WordPress doesn’t just make a page based off your URL structure.
You can create a “Page” called “location” if you need to show content there.
and if you want to list the available terms you have in the location taxonomy you can create a custom page template ex:
This will list all terms in locations taxonomy with links to each term’s archive.
Taxonomies actually do have archive pages like that, in the same way that categories do. You just have to be sure that when you register the taxonomy, that you do so with rewrites enabled and a slug. For example:
From Smashing Magazine
If they don’t immediately show up, be sure to visit
settings > permalinks
to reset the rewrites.To create a template specific to a particular taxonomy, in your case location, copy
archive.php
and rename the copytaxonomy-location.php
. This will give you a template specific to that taxonomy. If you want to create a template specific to an individual term, rename ittaxonomy-location-newyork.php
.