Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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:

add_action('init', 'custom_rule');
function custom_rule()
{
    global $wp, $wp_rewrite;
    $wp_rewrite->add_rule('^projects/clients/', 'index.php?pagename=clients', 'top');
}

Then on that template, form a custom query with your desired params (clients taxonomy) and loop through it.

Note: After you put the above code in your functions.php file, go to Settings > Permalinks, and click on save.

Hope this helps (I recommend you try it locally first)!

share|improve this answer
    
where are you including that code Rutwick ? –  Xavier Oct 3 '11 at 12:29
    
Please check my edited answer... –  Rutwick Gangurde Oct 4 '11 at 4:51

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 accessing http://www.example.com/tags/ which doesn't work.

http://www.example.com/projects/clients/ibm/ is taxonomy term URL. Its like accessing http://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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.