So let’s say i register a custom taxonomy called:
Clients
With a few terms such as: Microsoft, IBM, Apple
Under a CPT (custom post type) called projects
:
Permalinks
/%year%/%monthnum%/%taxonomy%/%postname%/
this is the structure i am using;
http://www.example.com/projects/ – Displays All posts under ‘projects’
http://www.example.com/projects/clients/ Displays a 404
http://www.example.com/projects/clients/ibm/ displays all posts under projects
with the term ibm
How can i get WordPress to display an Index of all the posts under Clients? so for example if the user visited /projects/clients/ all the posts with Microsoft, Apple and IBM would be displayed.
I know a method is to use a page and then query into the page, but in essence of SEO, and relevance, i can not name the page-slug something else.
Thanks in advance.
You need to write a custom rule. I did similar stuff for a recent project. Create a template, and assign it to a page, with slug as ‘clients’ (or anything you like, but change the slug in the following rule as well). Try the following code, use functions.php:
Then on that template, form a custom query with your desired params (clients taxonomy) and loop through it.
Hope this helps (I recommend you try it locally first)!
You cannot access the
clients
location because its not a term, its your taxonomy base.http://www.example.com/projects/clients/
is taxonomy base. Its like accessinghttp://www.example.com/tags/
which doesn’t work.http://www.example.com/projects/clients/ibm/
is taxonomy term URL. Its like accessinghttp://www.example.com/tags/example
which works.If you want to access
/clients/
URL then you should create a page with custom template that can display the contents of all posts under/clients/
taxonomy.