0

I use to do a lot of wordpress theming, but have since moved into developing without wordpress. I'm building a site right now that I would to have a custom post_type and taxonomy structure that resembles wordpress. Currently I'm trying to figure out optimal database organization and if I should create a table for my "post_types", or have a column in my posts table called post type. So I have a few questions about post types to help me make decisions.

  1. Why don't post-types have their own table, would it be optimal if they did?

  2. Are custom post types just to provide some link of how the wordpress template structure works? Ex: archive_{post-type}.php single_{post-type}.php

  3. If pretty permalinks were off would the url look like: example.com/archive_{post-type}.php for the index and example.com/single_{post-type}.php?post=some_post

  4. Would you advise I use a column in my post tables or create my own table for my own "post-types"? (I will be giving images their own separate table unlike wordpress)

Also sorry for the vagueness and opinion based question in 4, but I do believe even small answers might help me and others come to a conclusion of if they should use a model like wordpress post_types.

1 Answer 1

1
  1. Legacy reasons. At the beginning WP only had posts.

  2. No. There are uncountable other things connected. You can query for it separately, have other permissions, different backend UI and much more. Finding the right template might be one thing, but then again it doesn't have to be as the template hierarchy can be modified in many ways.

  3. No. It would look like this example.com/?{post_type}={post_type_slug} So a CP test for the CPT faq would be example.com?faq=test

  4. Maybe. You give way to little information and have too broad of a question. It depends on the details of your use case. Also when using some PHP framework it might already suggest or enforce some structure.

To close things I'd like you to question whether it is a good idea to imitate the structure of WordPress in the first place. When starting from scratch WP with all its backwards compatibility and legacy code probably doesn't set a good standard for starting from scratch.

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.