There are two ways of creating custom post types into WordPress: First is using a “plugin” but if you want to keep your WordPress website liteweight then adding a snippet of code to your child theme’s function.php would be the best practices.
Note: If you don’t want to keep your hands thirty then simple use custom post type maker plugin to generate your preferred custom post type. Also, using a ‘child theme’ is a must if you do the manual way of adding custom post type in your function.php otherwise your code would not be “safe”, it will be vanish once you update your Parent WordPress theme.
Now, Let’s begin to create a custom post type!
But first let me ask you a question, would you like to create a new one or just overwrite the existing default custom post type available on your WordPress theme? If the answer is both then no worries, I will reveal the solutions.
Register Your Own Custom Post Type :
Let say you want additional custom post type named “Calculators”? Your magic savior is to use the function called register_post_type( string $post_type, array|string $args = array() ) . That will allow you to register a new section on WordPress dashboard. Take note string $post_type can be anything, you can use whatever name you want!
Here’s the example syntax:
Overwriting default custom post type available in your WordPress theme
Now, what if there’s a default custom post type in your WordPress theme that is not useful and you just want to update the name? Example “the default Projects custom post type available in Divi“? Well, all you need to do is get the exact registered post type of that section. When you view to all section and view each projects, you will see that the reserve name is “project”
Make sure you note the reserve name and assign it to $post_type.
Rule of thumb: Once you activate your child theme and add the code to your child theme’s function.php, it will overpower the parent theme.
If you want to add more labels and arrays then here’s the complete list: Visit the WordPress register custom post type documentation for more guide about the syntax.