WordPress is one of the most popular website builders that allows you to organize your web content using built-in post types. However, there are only three built-in content types when you install WordPress; posts, pages, and media, and you can use eight default post types. Therefore, users must know how to add custom post types to WordPress for any content.
Adding custom post types to WordPress sets you apart from the competition and allows better rapport with your visitors, who find getting information from your website more accessible. Therefore, every WordPress user must know how to add custom post types. Please read below to learn everything you need about WordPress custom post types and how to add them.
What Are WordPress Post Types
To add custom post types to WordPress, you must first understand what post types are. Post types refer to the kind of content grouped in a particular way in WordPress. Users might be familiar with two of the most popular post types: posts and pages.
Posts enable website owners to share content on their sites. On the other hand, pages display permanent content on your website, such as an About us page. While these two are the most popular types, many websites seek to add newer types of content to stay above the competition. To allow so, WordPress allows users to add custom post types to WordPress and create unique content types.
Some of the post types available on WordPress by default include:
- Posts
- Pages
- Attachment
- Revisions
- Navigation menu
Therefore, you do not get much flexibility in creating different kinds of content for your websites. Knowing how to add custom post types to WordPress is essential to see if you want to make your website unique and more attractive to visitors.
Why Should You Add Custom Post Types to WordPress
While WordPress default post types encompass the majority of content types, there are several others that you may want to integrate into your website that WordPress defaults do not have. Some of these content types can include:
- Testimonials
- Reviews
- Limited-time events
- Portfolios
Since digital business marketing has become competitive, businesses are integrating different types of content to attract audiences. As such, you should do the same to stay ahead of the competition.
There are several reasons for adding custom post types to WordPress. Custom post types improve content visibility and make it easier for visitors to navigate different fields on your website, making it easier to find the information they need. Some of the several reasons why you need to add custom post types to WordPress include:
- You need to display new content differently from the available default options.
- The content does not match any of the pages that exist on your website
- You want to create a new information page on your website
- The content you post does not match the style of the existing content
- The content you post isn’t part of a chronological series but rather a separate entry
- You want to add infographics to your website
- You want to add content that is different from your competitors
Ways to Add Custom Post Types to WordPress
Since there is an ever-growing need for new content on your website, you must know how to add custom post types to WordPress. Generally, there are two main methods that you can use. Both these methods are discussed below.
Method 1: Manually Code a Custom Post Type
Manual coding provides a stable long-term option if you want to add custom post types to WordPress, and it’s easier for beginners who do not know much coding.
Before starting, remember to back up your websites in case things go wrong. Once you are done with that, access the files using the cPanel. Once you have connected your website to the cPanel, follow these steps:
- Search for the “public_html” folder.
- Inside the folder, clock on the “wp_content” file.
- Then, click on the “themes” file. This allows you to access your website’s themes. Find the active theme and open it.
- You will have to navigate to the “functions.php” file. This is where the main step begins.
Once you have opened up the file, you will have to enter the code:
function create_posttype() {
register_post_type( ‘elementor_product’,
array(
‘labels’ => array(
‘name’ => __( ‘Products’ ),
‘singular_name’ => __( ‘Product’ )
),
‘public’ => true,
‘has_archive’ => true,
‘rewrite’ => array(‘slug’ => ‘product’),
‘show_in_rest’ => true,
)
);
}
add_action( ‘init’, ‘create_posttype’ );
You must change the bold parts to fit the post types you want to add. If you leave the code as it is, you will not get any results. Once you are done, save the changes. You can now add custom post types to WordPress.
Method 2: Add Custom Post Types to WordPress Using a Plugin
If you are unfamiliar with coding and think it is too much work, you can also use a plugin to add custom post types to WordPress. However, remember that your posts will be integrated with the plugin, which means that if you delete the plugin, your post will disappear.
You can choose between several plugins, such as WooCommerce, The Events Calendar, or the Custom Post Type UI. These plugins automatically set up the custom post type, are perfect for beginners, and provide a user-friendly and effective way to manage your website content. In our guide, we will explain how to
To add custom post types to WordPress using a plugin, you must first install and activate the plugin you chose. To add custom post types using the Custom Post Type UI plugin, follow these steps:
- Go to the CPT IU option
- Click on the “Add/Edit Post Types”
- You will see a “Post Type Slug” at the top of the page where you can add your content slug.
- Once done, click on the option in front of the “Auto-populate labels” to create entries.
- Scroll Down to Setting.
- You can edit the setting of the custom post type by going to the settings option. However, you can also leave them to default if you wish.
- You can then edit the post features. The “Supports” section allows you to add various post editor features of your liking, such as comments, images, titles, and more.
- Click on “Add Post Type.”
You have successfully added the post type to your WordPress dashboard and can visit it whenever you want.
How to Display Your Custom Post Type on Your Website?
The good news is that you can add custom post types to WordPress now. The bad news is that your users still can’t see it. To display your custom post type on your website and make it visible to your visitors, follow these steps:
- Go to “Appearance.”
- Select “Menu.”
- Add a custom link to the “URL” and your post’s permalink.
- Save settings
- Your post is now visible on your website.
To Summarize
You can add custom post types to WordPress through two main methods, by code or by plugins. While plugins are more beginner friendly and allow for quick and easy post adding, the coding method is preferred by most since it does not rely on a third party to keep your posts up. Moreover, once you understand how to add custom post types through the coding method, it will only take a few minutes to repeat the process.