WordPress is highly versatile, but if you’ve ever wanted to go beyond posts and pages for more customised content (like portfolios, testimonials, or product listings), CPTs are the way to go. But, what does CPT stand for? This guide will walk you through the process of creating a WordPress CPT, giving your website design a more personalised structure tailored to your specific needs.
CPT stands for Custom Post Types. In WordPress, everything from blog posts to media files is saved as different post types. By default, WordPress includes several post types, such as post, page, attachment, revision, and nav_menu_item. But what if you want to add a specific type of content, like events or testimonials, with its own structure? This is where custom post types come in.
Creating WordPress custom post types allows you to organise and display specific types of content separately from your regular posts or pages. This WordPress feature offers more flexibility and control over your website design.
Before you start creating, consider what you want to achieve with your custom post type. Are you adding a portfolio, product listings, or an event section? Choosing a clear, descriptive name will help you organise your content more effectively. For example, if you want to add a “Testimonial” section to your website, you might name your custom post type “testimonial.”
The simplest way to create a WordPress custom post type is by adding code directly to your theme’s functions.php file. Here’s an example of how to register a custom post type called “Testimonials.”
Here’s a breakdown of this code:
Add this code to your theme’s functions.php file, then save it. Once you refresh your WordPress admin panel, you’ll see a new “Testimonials” option in the sidebar.
To customise how your custom post types display on your website, you can create template files in your theme. Here are some options:
The CMS will automatically recognise these files, allowing you to set up unique layouts for each WordPress custom post type.
To categorise testimonials, you might want to create a custom taxonomy. For example, you could categorise testimonials by “Industry” or “Client Type.” Here’s how to add a “Client Type” taxonomy:
This code registers a “Client Type” taxonomy you can use to categorise your testimonial custom post types.
If you’re not comfortable editing theme files, plugins like Advanced Custom Fields make it easy to create and manage custom post types without coding. Once installed, this plugin provides an intuitive interface in your WordPress dashboard to set up custom post types and taxonomies.
By default, WordPress doesn’t include custom post types in search results. To make them searchable, add this code to your functions.php file:
This code ensures that your testimonial posts appear in search results.
WordPress custom post types unlock new possibilities in WordPress, allowing you to organise and display specialised content in a more engaging way. For example, creating a WordPress custom post type for testimonials can help you highlight customer feedback in a more professional and organised way.
With a few lines of code (or a plugin if you prefer), you can add dynamic sections to your website that go beyond standard blog posts and pages. Experiment with custom post types to bring fresh functionality to your WordPress website design, and enjoy the flexibility to create the site structure that truly fits your vision!
WordPress’s versatility, flexibility and scalability are key factors as to why we work with it at KIJO. If you want support with WordPress custom post types, designing, or developing your WordPress website, contact us today.
Related Read: Why Use a WordPress Website Design Agency
Need expert guidance on your next digital project? Book a complimentary, 30-minute consultation with our Head of Partnerships & Co-Founder, Kirk Thompson. During your call, we’ll review your website’s current performance, discuss your goals, analyse competitor insights, and explore the potential of a WordPress-powered site. Let’s bring your vision to life—book your free consultation via the link below: