My recommendation for WordPress sites with dynamic content and custom types

When I started with WordPress, the first hurdle to take was the decision for a plug-in or framework to deal with custom post types and custom content.

WordPress itself doesn’t offer any functions for doing such kind of things without coding some PHP. For this reason, some people call WordPress the only CMS without templating engine.

Not that it’s bad to write some PHP code. If you are a WordPress rookie and want to learn more, it’s a very good approach to understand how it’s done by overriding an original file, hooking into some functions and doing stuff with some lines of PHP code. You will learn about The Loop and how highly adjustable and flexible WordPress is.

For rapid development and everyday use it’s still great to have a templating syntax at your finger tips, to implement most of what is typically used in dynamic web sites, by typing directly into the WordPress content editor instead of touching the PHP code files.

And before you can start with the content, you typically have to define your custom data types. Eg. the type ‘car’ with structured information and input fields for PS, cylinder capacity, year of construction, and so on, when you want to sell cars. The templating solution mentioned above should offer the ability, to loop through your custom types, list the objects in different ways, sort or filter the output, or display a single object and output all fields with some nice layout.

I tried out most of the popular plug-ins and frameworks, but wasn’t really happy with none of them. Some were so confusing that I found it much easier to write PHP, others lacked of important features.

Highly recommended

CMB2 to define your custom post types

Finally I was lucky and stumbled upon the CMB2 Framework to define my post types and have well working input forms without additional code. It’s free and comes with many pre-defined input types. It’s extensible and there are already some extensions that offer more advanced inputs.

There is also another plug-in, that lets you define new CMB2 types with a GUI in WordPress. But I prefer to do this in PHP code. This is basic schema for the site and rarely changed. It’s something that I don’t want to get changed by accident.

Custom Content Shortcode to output your data

Now that I have my custom types, I want to list and display the content on some pages. This can be done with the Custom Content Shortcode plug-in by Eliot Akira. This one is great! Beside the core functions for looping, sorting and filtering standard and custom fields and post types, it offers many other usefull shortcodes that you will want in practise.

Building reusable template blocks

There is only one thing missing yet: A templating option to build reusable blocks of any static or dynamic content, which can later be assembled to complex pages. This gap is perfectly closed by the Reusable Text Blocks plug-in, which works smoothly together with CMB2 and Custom Content Shortcode.

Conclusion

3 pieces of great open source software. They play well together and are my favorite solution for building WordPress sites like this one. Highly recommended.