Semalt Expert On Creating Custom Post Types in WordPress – 4 Easy Steps
Custom post types are the basic posts that have the different set of parameters defined in the codes. After the release of WordPress 3.0, it is easy for you to create your custom post types. If you create them successfully and with the right parameters, you will have a customized area in your dashboard and can grow your business. It's true that WordPress is a very powerful content management system that offers lots of blogging options. Over the years, it has grown into a huge platform and lets us build both basic and professional websites. New features are added every day, such as custom menus, post types, post formats, and widgets.
If you want to divide your web content into different categories based on its structure and layout of your site, you must create the custom post types. Inside your WordPress, you can define the categories, posts, and tags by particular authors. You can also add images and give credibility to your site, and all this is because of the custom post type.
Here Oliver King, a top specialist from Semalt, has discussed the four simple steps to create the custom post types in WordPress.
Step 1 – Register the Post Type
The first step is to register the post type. For this, you should open the functions.php file and add the specific doe in that. You should make sure that the code is inserted in the PHP tag. There are different codes which can be added here, but the most common codes are:
- function movie_reviews_init() – This helps us create new functions in the custom post types. This code is mainly inserted in the functions.php file.
- Label – This descriptive code should be inserted in the PHP file carefully. Wordpress will later use the information mentioned in this code to define your custom posts.
- show_ui – It helps generate default UI and helps manage the custom posts in the Admin panel. You can also set it true or false based on your requirements.
Step 2 – Test Everything
Once you have defined the custom post type in the functions.php file, you should head to the WordPress dashboard to check if everything is done correctly. If the things are properly done, you will see new menu items on the left side of the screen named as Movie Reviews. Hover over this option, and you will see different custom post types. Click on the Add New option and work on the displays of your custom posts. If you click on the view post option, you will see how your custom posts appear on the homepage.
Step 3 – Create the Custom Post Type Templates
If you are not satisfied with the current template of your custom posts, you can create the new file named as page-movie-reviews.php inside the theme's folder to get the theme changed. Inside this folder, you will have to insert a specific code before saving the settings. Make sure you have inserted the code properly and go back to the admin area to check if everything is accurate or not. The option of your new template will appear in the Page Attributes section.
Step 4 – Add More Options
If your website is about entertainment or movies, you can add a couple of movie reviews. For this, you will have to adjust the size of movie thumbnails from the WordPress account. You will see a collection of reviews which can be arranged and rearranged based on your custom post type.