As part of a continuous effort to improve our products, and give back to the open source community that is WordPress, the development team at 93digital regularly work on certain plugins and libraries that can help improve the WordPress community’s lives, even if just incrementally. This month, we’ve looked at solving a problem that could save many developers a lot of time over the years, Custom Post Types.
On 22nd February, the 93d development team released a modified library that can be used to work with Custom Post Types in WordPress. The library utilises a PHP class that allows developers to more easily and efficiently create and manage Custom Post Types in WordPress and was originally based on Joe Grainger’s PostTypes library.
Custom Post Types are a staple of good WordPress development. Used correctly, they allow us to take complex content hierarchies and information architectures and create flexible and easy to administer content management systems for our clients.
In the past, registering Custom Post Types has sometimes been a bit of a fiddly task, but this PHP class can be used to heavily streamline and simplify the task.
A new post type can be created by simply passing the post types name to the class constructor.
$books = new PostType( 'Book' );
And with this new code, you no longer need to set up the WP_Query parameters.
There are a range of other use cases and benefits for Developer’s from the library – find more about our library on the 93digital Github account. Here you will also find our WordPress plugins and other development work we open source for the benefit of the WordPress community.
If you would like to get in touch with 93digital to discuss an upcoming WordPress project, have suggestions on future alterations to open source code, please do get in touch