We can use custom post types to model any data in a wide range of business categories. In this chapter, we are going to build a property custom post type for real estate listing websites, to illustrate the use of custom post type features. In this section, we will develop features for creating custom post types, assigning custom taxonomies, and using custom fields.
First, we need to create a separate class for handing property-related features as we are using an object oriented plugin. So, create a new directory called classes inside the main plugin directory, and add a new file called class-wqcpt-property.php
. Then, we need to include this file in our plugin and create an object to initialize the features. We need to add the following line inside the includes
function of the WPQuick_CPT
class to include the file:
require_once WQCPT_PLUGIN_DIR . 'classes/class-wqcpt-model-property.php';
Next, we need to create an...