• I have standard posts in my site, plus a custom post type called Locations. I also created custom taxonomies for State and Country. Within Posts and Locations, you can assign states (e.g. Alaska) and countries (e.g. USA) to individual posts.

    What I’d like to do, at minimum, is have a custom taxonomy page for states (e.g. Alaska) that would show all the Locations with that state assignment. Ideally, I’d like to be able to show all Locations (custom post type) and Posts (standard post) with that state assignment.

    How do I do that without having to create taxonomy-state-alaska.php, taxonomy-state-arkansas.php. Is there a way to use a generic state template and then feed in individual state content on a dynamic basis?

Viewing 3 replies - 1 through 3 (of 3 total)
  • All of the templates are for showing posts (post types). So what is it in the template that you would need, specific to the taxonomy?
    Each term can have a description (which can be as long as you like, and with a small plugin even has a rich-edit box for it), and you can make your taxonomy template show that description (probably only on page 1).

    Thread Starter s545422

    (@s545422)

    Thanks for your reply. It’s a little hard to explain, but I guess I’m talking about the reverse: for a given taxonomy term, showing all posts (in this case, a custom post type) that reference that taxonomy term. Put another way:

    Custom Taxonomy: State
    – Term Post: Alaska
    – Term Post: Arkansas

    Custom Post Type: Locations
    – Locations Post: 123 Main Street, Anchorage, Alaska (using Alaska from above)
    – Locations Post: 123 Elm Street, Anchorage, Alaska (using Alaska from above)

    So what I’d be looking for is an Alaska page that shows:
    – Links to Locations Post: 123 Main Street, Anchorage, Alaska
    – Links to Locations Post 123 Elm Street, Anchorage, Alaska

    Is that possible to do through a custom taxonomy template without having to have a separate PHP file for all 50 states?

    As I said before, there is no need to make special templates. You should get the post list you want by default. If you want to put a lot of information on each term into the term descriptions, you can customize one template to show those on the first page of the archive.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Confused about taxonomy templates’ is closed to new replies.