admin管理员组文章数量:1291786
Can you please take a look at this post and let me know how I can navigate to Taxonomy URL properly? Having a CPT called movie
and a Taxonomy called genre
how I can navigate into archive of taxonomy.php
and taxonomy-genre.php
<?php
flush_rewrite_rules( false );
function custom_post_type_movie() {
$labels = array(
'name' => 'movies',
'singular_name' => 'movie',
'menu_name' => 'Movies',
'name_admin_bar' => 'Post Type',
'archives' => 'Item Archives',
'attributes' => 'Item Attributes',
'parent_item_colon' => 'Parent Item:',
'all_items' => 'All Items',
'add_new_item' => 'Add New Item',
'add_new' => 'Add New',
'new_item' => 'New Item',
'edit_item' => 'Edit Item',
'update_item' => 'Update Item',
'view_item' => 'View Item',
'view_items' => 'View Items',
'search_items' => 'Search Item',
'not_found' => 'Not found',
'not_found_in_trash' => 'Not found in Trash',
'featured_image' => 'Featured Image',
'set_featured_image' => 'Set featured image',
'remove_featured_image' => 'Remove featured image',
'use_featured_image' => 'Use as featured image',
'insert_into_item' => 'Insert into item',
'uploaded_to_this_item' => 'Uploaded to this item',
'items_list' => 'Items list',
'items_list_navigation' => 'Items list navigation',
'filter_items_list' => 'Filter items list',
);
$args = array(
'label' => 'movie',
'description' => 'Post Type Description',
'labels' => $labels,
'supports' => array( 'title', 'editor' ),
'taxonomies' => array( 'genre' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 2,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'movie', $args );
}
add_action( 'init', 'custom_post_type_movie', 0 );
function genre() {
$labels = array(
'name' => 'Movie Genres',
'singular_name' => 'Taxonomy',
'menu_name' => 'Genre',
'all_items' => 'All Items',
'parent_item' => 'Parent Item',
'parent_item_colon' => 'Parent Item:',
'new_item_name' => 'New Item Name',
'add_new_item' => 'Add New Genre',
'edit_item' => 'Edit Item',
'update_item' => 'Update Item',
'view_item' => 'View Item',
'separate_items_with_commas' => 'Separate items with commas',
'add_or_remove_items' => 'Add or remove items',
'choose_from_most_used' => 'Choose from the most used',
'popular_items' => 'Popular Items',
'search_items' => 'Search Items',
'not_found' => 'Not Found',
'no_terms' => 'No items',
'items_list' => 'Items list',
'items_list_navigation' => 'Items list navigation',
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
);
register_taxonomy( 'genre', array( 'movie' ), $args );
}
add_action( 'init', 'genre', 0 );
?>
In my theme directory I have 3 files for taxonomy like
in each of them I have code like
<?php
get_header();
?>
<main id="main" class="site-main" role="main">
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
// Display post content
the_title();
endwhile;
endif;
?>
</main>
<?php
get_footer();
in both http://wpdev/genre
and http://wpdev/movie/genre
I am landing in 404
page
本文标签: theme developmentLanding in 404 Page on Navigating to Custom Taxonomy Archive
版权声明:本文标题:theme development - Landing in 404 Page on Navigating to Custom Taxonomy Archive 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741541386a2384341.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论