What is a Custom Post Type?
Your WordPress website comes with two primary post types: blog posts and pages. You can extend your WordPress functionality by creating custom post types for the specific needs of your web portfolio. A post type can be pretty much any type of content (i.e. Events, Testimonials, FAQs).
Registering a custom post type (by adding code to your theme functions file or using the Custom Post Type plugin) adds a new admin sidebar item.
Instead of going to posts → add new… go to the newly created post type Video Testimonials → Add Video.
Creating Custom Post types the right way
Coding a custom post type into a theme directly does a disservice to your client. When they go to change themes in the future the custom post type will disappear. It is better to use a Custom Post Type plugin so the functionality will stay regardless of the active WordPress theme.
The official WordPress.org Theme Developer Handbook says,
Any theme you create should not add critical functionality. Doing so means that when a user changes their theme, they lose access to that functionality
WordPress Custom Post Type Plugins
Thankfully there are a number of powerful plugins that help you register custom posts.
- Custom Post Type UI – Using Custom Post Types UI plugin is the easiest way to create custom post types and taxonomies in WordPress. With this plugin you create post types and taxonomies, the plugin registers the CPT for you so you don’t need to edit the theme functions file.
- Advanced Custom Fields – Custom fields are a great way to extend the interface and fields of that custom post type. This plugin allows you to customize WordPress edit screens with specific fields. Field types include WYSIWYG, text, textarea, image, file, select, checkbox, page link, post object, date picker, color picker and more. You can also purchase some premium add-ons such as a repeater field.
- Custom Post Type Shortcode – “List custom post type posts using shortcode with any page or post.” It’s as easy as creating a page and entering a short code [cpt_list]. Additional options can be added to the shortcode to customize the output [cpt_list post_type=”testimonials” category=”classes” show_post_content=”true” excerpt_only=”false” use_single_blocks=”true” wrap_with=”div class=’testimonial'”]. Walla! A page of testimonials for the category classes. There are a slew plugin options available.
- Post Types Order – “Order Posts and Post Types Objects using a Drag and Drop Sortable JavaScript capability”. This plugin makes it so easy for the client to reorder their posts.
- Simple Custom Posts per Page – “This plugin allows to configure the number of posts displayed for every custom post registered.” After activating the plugin go to your Settings -> Reading page. All your custom post types will be listed here. Set the number of custom posts to displayed on every page.
Custom Post Types are so powerful! With a little code and some new theme files, we can output and format both the custom post types and the custom fields in any way we want. If coding isn’t your thing, use the Custom Post Type Shortcode to display your custom post types.
Thanks for sharing not only our plugin here but all the other plugins as well. I known from experience that all the plugins are well built and help to speed up development time and makes things much easier. A lot of plugins conflict with the way WordPress works and I can say personally that with these plugins you won’t have any trouble if used right.