wphats

Add Custom Post Type in WordPress without plugin

Add Custom Post Type in WordPress without plugin

There are numerous plugins can be found through search results against Custom Post Type in WordPress repository which will allow to create custom post type for a WordPress site. They are might be excellent, good or average but one disadvantage to use plugin is added lots of functions with jQuery library that causes heavy loading of sites. Many functions may not be necessary with your own or purchased theme. Some plugins causes extra loading time for a site.

custom-post-type

So if you have a bit technical knowledge you can overcome this problem through use custom code for your site. This is very light, simple and convenient ease of use. So follow few steps that will take less time to install & setup than a WordPress plugin.

Let’s say your custom post type name is ‘SERVICE’.

# First open your functions.php and copy & paste the below code at the bottom:

 

If you paste above full code & refresh your Admin Dashboard you can see one custom post type named ‘Services’ added in left navigation. Now your turn to make changes according to your own custom post type.

So change the name ‘your-custom-post-type-name’ i/o ‘service’ in every places. But must remember the register_post_type(‘post-type’, $args) function where you can pass the post type name & this name will use to display in front as single page.

Once done, just copy duplicate your single.php file and rename it as single-{custom-post-type}.php that will allows you to display post information. That’s all. Any further information’s please make a comment below. We will respond in our shortest period.

Thank you.

This post has already been read 1003 times!

Mehedi Hasan

Cool WordPress Developer having much agile experience to develop any kind of WordPress sites & plugins. Also good in troubleshooting, fixing & making any kind of tweaks for WP site.

More Posts

POSTED ON: Wordpress Basics, Wordpress Development
TAGGED : , ,

Leave a Reply

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