Custom post type? Confused ?
Cheers! Don’t be getting confused. Please read the following paragraph once. 🙂
What is custom post type then?
Custom post type is simply WordPress content like the page, post etc. WordPress simply have following post types.
- Post
- Page
- Attachment
- Revision
- 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 the 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 array( '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.
Hello, just wanted to mention, I loved this blog
post. It was inspiring. Keep on posting!
When someone writes an article he/she keeps the thought of a user in his/her mind that how a user can understand it.
Therefore that’s why this piece of writing is outstdanding.
Thanks!