我在我的主题上创建了一个自定义帖子类型(deals)、术语(project)、菜单(top\\u menu)和归档页面(archive deals.php)。我想在存档页面中显示术语帖子列表。但当我单击“术语”菜单,然后重定向以下链接时:http://localhost/wordpress/chorui/project/html-3/ 和显示未找到错误消息页。
<?php
// Custom post and terms
add_action( \'init\', \'create_post_type\' );
function create_post_type() {
register_post_type( \'deals\',
array(
\'labels\' => array(
\'name\' => __( \'Deals\' ),
\'singular_name\' => __( \'Deal\' )
),
\'public\' => true,
\'has_archive\' => true,
\'hierarchical\' => true
)
);
}
register_taxonomy("project", array("deals"), array("hierarchical" => true, "label" => "Project Types", "singular_label" => "Project Type", "rewrite" => true));
?>
<?php
// archive-deals.php
get_header();
wp_nav_menu(array(
\'theme_location\' => \'top_menu\',
\'container\' => \'nav\',
\'container_class\' => \'top_menu\',
\'fallback_cb\' => false,
\'items_wrap\' => \'<ul>%3$s</ul>\'
));
/* Start the Loop */
while ( have_posts() ) : the_post();
//This will return the content of the CPT archive
get_template_part( \'content\', get_post_format());
endwhile;
if ( function_exists(\'wp_bootstrap_pagination\') ) {
wp_bootstrap_pagination();
}
get_footer();
?>