The main addition to JetEngine 2.5.0 is CCT – Custom Content Type module. What opportunities does CCT open, and how does it differ from our familiar Content Post Type (CPT)? Also, when should you choose a CCT, and when should you choose a CPT while building a site? You will find all the answers in this article.
Custom Content Type module – the origins
Let’s start from the beginning, I mean, The Custom Post Type! I bet everyone out there knows what it is. Just in case, here’s a quick explanation:
Custom Post Type (CPT) is any post type that differs from simple posts. For example, there are the default post types like pages or media, but if you need to create something different, e.g., car or property post, you need to expand the default functionality by creating the Custom Post Type.
JetEngine enables creating CPTs for organizing your site’s content within a simple and intuitive interface. Learn more about how to create a custom post type.
CPT is a very well-known and convenient solution, but it has its peculiarity. All the data it includes is stored in two database tables – post and post meta. Moreover, every meta field of every post is stored as a separate row, which means that if, for example, we have a custom post type with 20 meta fields, it will occupy 1 row of the post database table and 20 rows of the post meta database table. Thus, if we add 100 posts, their data will occupy 2100 rows of the database.
The bad thing about large databases is that it takes a long time for the system to process all the records to find the required data. Ultimately, the more data you have on your site, the slower its loading speed. We wanted to solve the issue. And that’s how Custom Content Type appeared.
What is a Custom Content Type (CCT)?
Custom Content Type (CCT) is any post type that differs from simple posts and allows you to create a separate table in the WordPress database to store its data. You can configure its structure and add an interface to the admin panel to view, edit, and export data stored in this table.
In other words, CCT is quite similar to CPT, but all the data of each custom content type is stored separately from the rest database. Besides, every item of any CCT is just one row of the table, which means that 100 posts occupy 100 rows of the database, unlike 2100 within CPT. Also, these 100 rows will be stored in a separate table, so when we select regular posts from the database, the data from our CCT will not affect them in any way, ultimately not affecting the website loading speed.
Custom Content Type vs. Custom Post Type
Although Custom Content Type might become a real turning point in the world of WordPress, the current version is the first one and not flawless yet. While the Crocoblock team is working hard on CCT’s further development, there’re still some cases when you better choose Custom Post Types, for example, if you are going to use the default archive system by taxonomies or plugins that are not compatible with CCT yet.
To make it easy for you to decide whether to use CPT or CCT in some particular cases, we have prepared this graphic:
How to Use Custom Content Type
Now let’s look at the striking examples of when you should definitely use the Custom Post Type. Please, pay attention to the anchor links within the description – they lead to video fragments of a detailed explanation from the latest Custom Content Type presentation by our CTO Andrew Shevchenko.
Custom Content Type for data storage
The simplest example is a subscription form on a website. If using Custom Post Type form, then each new subscription is stored as a separate post on the backend. If there are lots of subscriptions, after a while, they will significantly influence all widgets, single pages, and even the menu. And here Custom Content Type will help us out! If creating the subscription form as the CCT, all data will be collected in a separate table, which does not affect the site in any way. You can also download the data from this table in CSV format, either in full or by any custom parameters.
Custom Content Type for displaying data
Do you want to not only save data but also show it publicly? We should use JetEngine’s listing grid to display this data on the front-end.It is necessary to create a new listing grid item and select Subscription CCT as its source. The grid listing is edited the same way as the custom post types by using dynamic widgets or dynamic tags. All we need is to select the data that we want to show, and apply styles. Next, you need to add this widget on any static page. Done.
Custom Content Type for advanced filtering
Custom Content Type for the detailed descriptions
Suppose that in addition to the listing, we also want to show detailed information aboutthe subscribers. To implement this, we can synchronize CCT with a custom post type – in this case, CCT will be responsible for storing metadata, listings, and filtering. A custom post type will be responsible for displaying single pages. The second way is to use a popup that can be configured using JetPopup. We can use the popup to display detailed information and as an order form if we are building a custom store. Learn more about how to show detailed information with the help of popups in this video presentation.
Conclusion and next steps
Although we’ve launched the Custom Content Type module recently, it already shows the greatest advantage – scalability. You can add any number of items, and it won’t affect the database. Ultimately it means faster queries, faster filtering, less server resource usage.
In the further versions of CCT by Crocoblock, we are planning to add:
- Compatibility with map listings
- REST API support
- Indexer support for filters
- Relations between content types (similar to those for post types)
- The ability to output data in table format with filters on the front-end
- The ability to output data in graph format on the front-end
Have you already tried the Custom Content Type module? Was it easy for you to figure out how to use it? Do you find this module useful overall? We look forward to your feedback in the comments below!