Posted on

How to create custom post type in wordpress ?

Custom post type ? Confused ?
Cheers! Don’t be get confused. Please read following paragraph once. 🙂

What is custom post type then ?
Custom post type is simply wordPress content like page, post etc. WordPress simply have following post types.

  1.  Post
  2. Page
  3. Attachment
  4. Revision
  5. Nav Menu

So, post type is simple content and it’s like a content category but not actually category. It’s like a group of content.

How can i register my own custom post type ?

Dude ! It’s very simple, very means it’s simple 🙂 But main thing is you have to know what is simple php functions and how wordpress php file structure is? and some basic WordPress hooks. That’s all for custom post type.

ohh ! Still confusing ? Then let’s write this code in your theme directory’s functions.php.  🙂

// Our custom post type function
function create_posttype() {

register_post_type( 'movies',
// Custom post type Options
'labels' => array(
'name' => __( 'Movies' ),
'singular_name' => __( 'Movie' )
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'movies'),
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );

That’s all for now 🙂 Now look around on backend, you will find your custom post type.

Looks like it’s very interesting ?
Want to know more about custom post type ?
Then please follow the following official link from WordPress.

Leave a Reply

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