Custom Post Types and taxonomies are two powerful features of WordPress. When WordPress 2.9 was introduced it offered users the ability to add custom post types to their sites for the first time. WordPress 3.0 allows users to not only add custom post types but to also tie into the admin area of the WordPress backend all with fewer lines of code. By default WordPress comes with post and pages as the main content types. However you can create as many custom content types as you like, and these custom content types are referred to as Custom Post Types & also you can generate Custom Post Types.
Register post type is the default post type register function.
Register Post Type
Here’s the first bit of code we need to add to functions.php, which I’ll review below. There are two type custom post register system:
Just replace your text-domain and post type. You can generate this code from Post Type Generator website. Anyone who’s worked with WordPress before will recognize the structure here. We’re adding an action when the WP Admin initializes to call the function function custom_product_type(). In that function we create two arrays, $labels and $args, and then use register_post_type to pull it all together.
Now, we need call the custom post by a template file. We we’ll create two files by named single-product.php & archive-product.php. Given bellow the code loop for those file.