0

In a site I'm building currently I have a custom post type "story".

Each story can be assigned a country. Now country could easily be a taxonomy-term but I'm thinking in the future of creating an editable profile page for each country using custom post type call "country" while retaining a list of stories on that page. What is the best way to do this?

Dan

3

There are essentially two distinct approaches to this:

  • countries as terms
  • associated natively as taxonomy
  • information as taxonomy meta (needs table created, see Metadata API)
  • front-end display as taxonomy categories

or

  • countries as custom post type
  • associated with post relationships (needs plugin sich as Posts 2 Posts)
  • information as post + custom fields
  • front-end display as custom post type

Essentially either way is viable and it depends on what you feel more comfortable with and what nature and amount of information you will need to make editable.

  • Could you expound on option two? Obviously I would need to select a country to assign to a story. – Dan Lee Mar 18 '12 at 19:13
  • @Dan Lee unfortunately many-to-many relationships between posts are not natively available in WP, so it depends on specific third party implementation. See linked plugin for starters, it's popular way to accomplish it. – Rarst Mar 18 '12 at 19:45
0

How you are doing it sounds perfect. All you have to do is create a taxonomy-country.php file in your WordPress themes directory and It will display all posts from that taxonomy.

http://codex.wordpress.org/Template_Hierarchy#Custom_Taxonomies_display

In that file you just do the regular loop and it will display all posts that have the countries taxonomy associated with it. You can even create special taxonomy pages for say mexico, you would create a taxonomy-country-mexico.php file.

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.