Custom Post Type with Custom Taxonomy
Create a custom post type with a custom taxonomy.
<?php function create_custom_post_type_and_taxonomy() { // Custom Post Type register_post_type( 'portfolio' , array ( 'labels' => array ( 'name' => __( 'Portfolios' ), 'singular_name' => __( 'Portfolio' ) ), 'public' => true, 'has_archive' => true, 'supports' => array ( 'title' , 'editor' , 'thumbnail' , 'excerpt' ), 'rewrite' => array ( 'slug' => 'portfolio' ), 'menu_icon' => 'dashicons-portfolio' , )); // Custom Taxonomy register_taxonomy( 'portfolio_category' , 'portfolio' , array ( 'labels' => array ( 'name' => __( 'Portfolio Categories' ), 'singular_name' => __( 'Portfolio Category' ) ), 'hierarchical' => true, 'rewrite' => array ( 'slug' => 'portfolio-category' ), )); } add_action( 'init' , 'create_custom_post_type_and_taxonomy' ); ?> |
Post Comment