Hi WordPress folks, hope you are I good health and spirit. Today, I am going to share very useful tutorials with you, which will save your tons of time during developing WordPress websites. Please keep your close attention in this post as I am going to explain how to create custom post type in WordPress.
Custom post types are the same like WordPress pages and posts. There are some post types are comes inbuilt from default WordPress installation like Post, Page, Attachment, and revision. WordPress provides features to create more custom post types as per your requirement, assume you have started developing a recipe site and want to create a separate post type for recipes, then you can create by using some script in your functions.php file.
Use the below code to create custom recipes post type.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | // Our custom post type function function create_posttype() { register_post_type( 'recipes', // Options array( 'labels' => array( 'name' => __( 'Mecipe' ), 'singular_name' => __( 'Recipe' ) ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'recipes'), ) ); } // Hooking up our function to theme setup add_action( 'init', 'create_posttype' ); |
You can also create custom post type by using WordPress plugin. In this tutorial, I will explain a WordPress plugin which provides you an option to create multiple custom post type as per your requirement via UI options.
Custom Post Type Maker a WordPress plugin which provides an option to create custom post type via UI options with lots of features. Download the latest version of this plugin from plugin directory of wordpress.org and install it in your WordPress blog/website. If you have just started with WordPress Read:
After the installation of this plugin click on the activate button to enable the plugin features. Now navigate to the Dashboard =>Post Types click on the Add New option to create recipe type custom post and fill the required fields and follow the instruction to create custom post type.
You can also create your own custom taxonomies to use in custom post types. In the below screenshot I have created a separate category taxonomies for recipe. Click on the Taxonomies submenu from Post Types left menu and click on the Add New button to create a new taxonomies.
Above are the steps to create a custom post type as per your requirement in your WordPress sites. Hope this tutorial help you. Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool WordPress tutorials.
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: custom post type wordpress, custom post types, custom post types wordpress, wordpress custom post type plugin, wordpress custom post type template, wordpress custom post types, wordpress post types