WordPress as CMS – Making the Connection
One of the things that excited me (and scared me) about being able to create an unlimited number of content types was the connections that could be formed between items of different types. What excited me about this was the “automatic” nature of it– being able to define a connection between one content type and another, and then everything else would take care of itself. What scared me, was I wasn’t exactly sure how I was going to do this.
I spent some time yesterday working out the specifics of storing connections between content types and connections between different items (posts) and I’m pretty happy with the result.
An example of how connections can be useful:
Say you have 2 content types:
- Recipes
- Ingredients
Of course, all recipes must contain ingredients, so we need to tell the CMS that these two content types are connected. We can also define the type of connection between these items (“One to One” or “One to Many”).
- One to One: One item of one content type can connect to one item of another content type
- One to Many: One item of one content type can connect to several items of another content type
Will a recipe need to connect to just one ingredient, or will it need to connect to several? In this case, we would want to be able to connect a recipe to several ingredients, so we’re going to create a One to Many relationship between Recipes and Ingredients.
Now, when I’m adding a new recipe, thanks to the connection between these two content types, a list of ingredients will be displayed in the form to select ingredients that the recipe uses. Since this is a One to Many relationship, each ingredient has a checkbox next to it so that I can select multiple ingredients from the list. If it were a One to One relationship, the ingredients would be displayed as a drop-down list, which would only allow for one ingredient to be selected.
I really like the possibilities of this feature, but I think the goal now is to make it usable. In my opinion, it’s quite powerful as a feature, but it’s also somewhat abstract. So I’ve got to find a way to make it instantly clear how this feature could be useful to a user.