Add Custom Taxonomy:
add_action( 'init', 'cptui_register_my_taxes_movies' );
function cptui_register_my_taxes_case_study() {
$labels = array(
"name" => __( 'Category', '' ),
"singular_name" => __( 'Movies', '' ),
);
$args = array(
"label" => __( 'Category', '' ),
"labels" => $labels,
"public" => true,
"hierarchical" => false,
"label" => "Category",
"show_ui" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"query_var" => true,
"rewrite" => array( 'slug' => 'movies', 'with_front' => true, ),
"show_admin_column" => false,
"show_in_rest" => false,
"rest_base" => "",
"show_in_quick_edit" => false,
);
register_taxonomy( "movies", array( "movies" ), $args );
}
Add Custom Post type:
function create_posttype() {
register_post_type( 'movies',
// CPT Options
array(
'labels' => array(
'name' => __( 'Movies' ),
'singular_name' => __( 'Movie' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'movies'),
)
);
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );
Show Comments
