0

Quite a straight-forward question but I haven't been able to find a solution. I have created a page which lists categories within a taxonomy called 'Themes'. I now want each link in the list to point towards an index page which displays all of the pages for that particular category.

The way I see it, it's a bit like a search results page, because I only want to create one template page for the results, but the results will vary depending on what Taxonomy category is clicked.

E.g. This is what I want to happen:

The post-type is called Events.

Within Events there is a taxonomy called Themes.

Themes has a number of categories such as Boat, Fishing, Walking, Eating etc.

On one of the pages, user clicks on the Boat category listed.

User is then taken to a page which displays all of my post-type pages within the Boat category under the Themes taxonomy.

Hope this is clear, if you need any clarification just let me know.

Thank you

1 Answer 1

1

It is actually quiet easy using WP page template and taxonomy templates (Why do you want to display all results on one page? I think it is better when you URLs will have some logical structure).

You can create new page template and use wp_list_categories function:

<?php
/*
Template Name: Taxonomy Terms
*/

get_header();

?>
<div id="primary">
    <div role="main" id="content">
<?php

        wp_list_categories( 'title_li=Themes&taxonomy=theme' );

?>
    </div>
</div>
<?php

get_footer(); 

This will outpout the list of all the terms (categories) for your custom taxonomy "theme".

Additionally you can use WordPress templates hierarchy to modify the display of others template. e.x. taxonomy-theme.php

3
  • Thanks for your comment @JohnnyPea, but although this lists a particular taxonomy category, I also need to be able to style the results, rather than have a simple list of items. Have a look at this code: [link](git://gist.github.com/1222153.git)
    – remi90
    Sep 16, 2011 at 13:44
  • I've managed to grab EVERY taxonomy category in a way that allows me to style it accordingly, however I need to know how I display only ONE taxonomy category which depends on what link the user clicked on the previous page. I think my example in the original question makes it clearer to understand
    – remi90
    Sep 16, 2011 at 13:46
  • Your link is not working and I still don't understand. Sep 16, 2011 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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