0

I am stuck on trying to create a template page that displays a list of the names in a specific custom taxonomy of a custom post type I created.

The custom taxonomy is locations and clicking on a location like New York, should take you to a list of all the post types that are connected to that location.

I have looked at get_the_terms_list but I have not been able to produce the list. Don't really know what steps and pages I have to create to do all this so any help would be appreciated.

1
  • code samples would be appreciated? Oct 19, 2013 at 8:22

1 Answer 1

0

I am assiming you already register taxonomy which show you correct links (and generate correct rewrite rules)... but lets make a checklist.

1) Register Taxonomy and assign it to different post types

done by you...

2) Modify a rewrite rules

add_filter('locations_rewrite_rules', 'se_119400_locations_rewrite_rules');
function se_119400_locations_rewrite_rules(){
    $rules = array();
    $rules['location(/?(([^/]+?)(/page/?([0-9]{1,})/?)?)?)$']     = 'index.php?locations=$matches[3]&paged=$matches[5]&post_type=any';
    return $rules;
}

3) Taxonomy template?

Create a taxonomy template taxonomy-locations.php - this will show you a list of posts..

4) Actuall locations list/cloud?

wp_tag_cloud

<?php
 wp_tag_cloud(array('taxonomy' => 'locations'));
7
  • The code can be affected by my framework functionality (i did a tests on dev enviropment with taxonomy location - which is almost same), but in general it working example. Oct 19, 2013 at 8:21
  • Which page would the code for the rewrite rules go?
    – eufracio
    Oct 19, 2013 at 22:46
  • And what page would the code for the list/cloud go?
    – eufracio
    Oct 19, 2013 at 22:46
  • rewrite rules to functions.php and the wp_tag_cloud to place where you want to show the locations tags cloud Oct 20, 2013 at 6:51
  • Awesome! This worked for me.
    – eufracio
    Oct 20, 2013 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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