Create the ff. class, replace the class name and the private variable values and call it.

class CustomPostTypeJobs
{
private $postTypeName = 'Jobs';
private $postTypeNameSingular = 'Jobs';
private $supports = array( 'title', 'editor', 'thumbnail', 'categories');
public function __construct($options = array())
{
if (!is_array($options['supports'])) {
$options['supports'] = array();
}
$this->supports = $options['supports'] + $this->supports;
add_action('init', array($this, 'createPostType'));
}
public function createPostType() {
register_post_type( 'jobs',
array(
'labels' => array(
'name' => $this->postTypeName,
'singular_name' => $this->postTypeNameSingular
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => strtolower($this->postTypeName)),
'supports' => $this->supports,
)
);
}
}

 

Leave a Reply