Create Custom Post Types in WordPress

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.

Step 2
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:

2. Elaborate:

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.

Published by

S M Hasibul Islam

I am S M Hasibul Islam (Bachelor of Computer Science & Engineering), a web programmer with more than 5 years experience as like skill php, mysql, html5, css3, javascript, jquery, wordpress, responsive/mobile web design, hosting managements with VPS, shared server, also web UI, SEO, SMM.

One thought on “Create Custom Post Types in WordPress”

  1. Hi! I know this is somewhat off topic but I was wondering which blog
    platform are you using for this site? I’m getting fed up
    of WordPress because I’ve had problems with hackers and I’m looking at options for another
    platform. I would be awesome if you could point me in the
    direction of a good platform.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">