Creating Custom Post Type in WordPress

Posted in Tutorials

Tweet This Share on Facebook Bookmark on Delicious Digg this Submit to Reddit

In this tutorial, we are going to add a custom post type of “Employees” to our WordPress theme.   We attach our own function create_employees_post_type to the “init” hook.  In there, we call the basic form of register_post_type WordPress API…

basic post type

Now in dashboard, we see the Employees post type appear…

new post type

But you will notice that doesn’t have all the support that a regular post have — such as “Featured Image” and “Custom Fields” etc.

These you have to add additional options like this …

custom post options

 

But it gets more sophisticated with more options in the function reference.

To display your custom post type, put something like this in your template…

display custom posts