Sunday 14 October 2018

CUSTOM POST TYPE IN WORDPRESS

function create_whychoosetaxhint_post_type() {
register_post_type( 'whychoosetaxhint',
array(
'labels' => array(
'name' => esc_html__('Why Choose Tax Hint', 'whatwedo-list'),
'singular_name' => esc_html__('Why Choose Tax Hint', 'whatwedo-list'),
'add_new' => 'Add New',
'add_new_item' => 'Add New Why Choose Tax Hint',
'edit_item' => 'Edit Why Choose Tax Hint',
'new_item' => 'New Why Choose Tax Hint',
'view_item' => 'View Why Choose Tax Hint',
'search_items' => 'Search Why Choose Tax Hint',
'not_found' =>  'Nothing Found',
'not_found_in_trash' => 'Nothing found in the Trash',
'parent_item_colon' => ''
),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'menu_icon' => 'dashicons-building',
//'rewrite' => true,
'rewrite' => array('slug' => 'whychoosetaxhint'),
//'rewrite' => array('slug' => '%education_type%'),
'capability_type' => 'post',
        'has_archive' => true,
'hierarchical' => true,
'menu_position' => null,
'supports' => array('title', 'editor', 'author', 'thumbnail', 'revisions', 'page-attributes', 'comments'),
'taxonomies'   => array( 'whychoosetaxhint',  'post_tag' )
)
);
}
add_action( 'init', 'create_whychoosetaxhint_post_type' );

register_taxonomy("whychoosetaxhint_type", array("whychoosetaxhint"), array(
"hierarchical" => true,
"label" => "Categories",
"singular_label" => "Category",
'show_ui' => true,
        'query_var' => 'whychoosetaxhint_type',
        "rewrite" => true
));