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.

I need assistance with site structure with regard to properly setting up my Custom Post Types and Taxonomies.

I am developing a lifestyle site. It will not be a WP multi-site configuration.

This site will focus on several cities with several categories/topics and sub cats/topics.

  • domain
    • City
      • City Topic
        • City Topic Sub
          • City Topic Sub Sub

domain_name/city/city_topic/city_topic_sub/city_topic_sub_sub/

As you can imagine there is a lot of “cross pollination” of all of these post. For example a topic or sub topic may be relevant and therefore associated with more than one city eg a specific post on heath topic might appear in all cities. Or a maybe another post might only be associated with just 2 cities. There will also be an “all cities” for readers that do not live within the area of a city that we have.

My first question is how is the best way to structure the backend with regard to CPT’s and Taxonomies. I know there are a lot of ways “to skin a cat” but I need to set it up to give me the most flexibility for future expansion and also provide the most flexibility with regard displaying the content within the database in various scenarios.

I know I want/need to utilize custom post types to segment all the numerous posts that will be within this site.

My current thoughts are to utilize Pippins “Content Post Type” plugin for the creation and management of the CPTs, Taxonomies and Meta Info.

I also think that Scribu’s “Posts 2 Posts” plugin would play a part in this based on it’s many-to-many post relationship capabilities, but for the life of me I can’t figure it out.

Any advice would be appreciated.

share|improve this question

1 Answer 1

URL structure and data storage are separate issues. You can use any data in an URL, so let’s ignore that part for now.

Next step: By naming the parts sub and sub sub you went into the wrong direction. Just focus on what the information is, not where it belongs.

Data objects

City should probably a custom type, because you will need custom meta data for that. And I would make that a hierarchical post type, because in large cities it is rather useless to present results from a part of the town that is two or three hours away.

Now look at the relationships between the objects:

  • 1:1 or 1:n (n = many) post meta data; examples: latitude and longitude, average price for a cup of coffee or a bockwurst. :)

  • n:m (many to many) taxonomy; each term can apply to many objects, each object can be part of multiple terms; examples: spoken languages, accepted currencies.

  • If an object needs many custom meta data, use a custom post type for that. There is still no term meta in WordPress. You can use the Posts 2 Posts plugin to misuse the post types as pseudo-taxonomies, but this is not trivial.

Permalinks

You can use any data in any permalink. See my plugin T5 Rewrite for an example. You can even use that plugin and create custom child classes to add post meta data or custom taxonomies to any permalink. Examples for regular posts are already included.

Search

By default, WordPress will not search in terms and post meta data. You can change that by filtering the_search_query (example).

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.