Reference library

Article number: 301651

Posts example

The best way to illustrate the power of the new posts system is via an example. The one chosen relates to a fictional training system, based around courses made up of multiple modules being given by several trainers in different rooms in different office locations. It contains multiple posts all related to each other.

In database terms this structure is not 'flat', there are complex relationships going on all of which can be successfully modeled by the new posts. The image below is a traditional Entity Relationship (or ER) diagram for the training example which is often used to model data systems prior to build.

erTraining

What this diagram shows are the relationships between the things we want to store and list in our system. In the diagram the rectangles are entities and these will be our post types, the diamonds represent the relationships between the posts and the elipses represent information (fields) that we store for each post.

So for example the diagram indicates that the courses post type will have 4 fields: title, level, date range and places. It will also relate to modules, trainers and also to itself as some courses will have other courses as a pre-requisite.

You don't have to create an ER diagram prior to creating your post system but if you have the knowledge to do so it can be a useful way of clarifying the relationships.

In summary the system will have:

  • Courses which can be made up of multiple modules, courses can have other courses as pre-requisites. Courses are led by a trainer.
  • Modules are given by a trainer in a training room and are periodically subject to reviews.
  • Reviews review modules and their respective trainers.
  • Training rooms are used to teach modules in and are in a specific training location.
  • Training locations can have more than one training room.

The next page show how these entities/post types are created in Sitekit.

Related questions