I created a custom post type using following code:
add_action( 'init', 'create_team_post_type' );
function create_team_post_type() {
register_post_type( 'portfolio',
array(
'labels' => array(
'name' => __( 'Portfolio' ),
'singular_name' => __( 'Portfolio' )
),
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'taxonomies' => array('portfolio_category'),
'supports' => array('title','editor','thumbnail')
)
);
}
and taxonomy using following code:
function taxonomies_portfolio() {
$labels = array(
'name' => _x( 'Portfolio categories', 'taxonomy general name' ),
'singular_name' => _x( 'Portfolio categories', 'taxonomy singular name' ),
'search_items' => __( 'Query portfolio categories' ),
'all_items' => __( 'All portfolio categories' ),
'parent_item' => __( 'Parent category' ),
'parent_item_colon' => __( 'Parent category:' ),
'edit_item' => __( 'Edit portfolio category' ),
'update_item' => __( 'Update portfolio category' ),
'add_new_item' => __( 'Add Edit portfolio category' ),
'new_item_name' => __( 'New portfolio category' ),
'menu_name' => __( 'Categories' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'rewrite' => true
);
register_taxonomy( 'portfolio_category', 'portfolio', $args );
}
add_action( 'init', 'taxonomies_portfolio', 0 );
When I click on category that is navigating to index.php
. I created a file name called taxnomy-portfolio_category.php
. The URL is showing url/taxnomy-portfolio_category.php/cat_name
but the result is index.php
.
taxnomy
?taxonomy
.