我正在一个有工作列表部分的网站上工作 . 我使用自定义帖子类型创建了作业列表 . 我创建的每种帖子类型都链接到一个类别 .

在工作列表页面上,一旦人们点击一个工作,他们就会看到工作描述,在侧边栏中看到工作类别 .

我的问题是,当我点击侧边栏上的类别链接时,它会给我一个空白页面 . 我创建了一个名为“Category.php”的模板来显示与某个类别相关的所有帖子 . 在模板中,我已经放置了正常的WordPress循环 .

这是我的代码:

if ( ! function_exists('Job') ) {

//注册自定义帖子类型功能Job(){

$labels = array(
    'name'                  => _x( 'Jobs', 'Post Type General Name', '_scorch' ),
    'singular_name'         => _x( 'Job', 'Post Type Singular Name', '_scorch' ),
    'menu_name'             => __( 'Jobs', '_scorch' ),
    'name_admin_bar'        => __( 'Jobs', '_scorch' ),
    'archives'              => __( 'Job Archives', '_scorch' ),
    'parent_item_colon'     => __( 'Parent Job:', '_scorch' ),
    'all_items'             => __( 'All Jobs', '_scorch' ),
    'add_new_item'          => __( 'Add New Job', '_scorch' ),
    'add_new'               => __( 'Add New', '_scorch' ),
    'new_item'              => __( 'New Job', '_scorch' ),
    'edit_item'             => __( 'Edit Job', '_scorch' ),
    'update_item'           => __( 'Update Job', '_scorch' ),
    'view_item'             => __( 'View Job', '_scorch' ),
    'search_items'          => __( 'Search Job', '_scorch' ),
    'not_found'             => __( 'Not found', '_scorch' ),
    'not_found_in_trash'    => __( 'Not found in Trash', '_scorch' ),
    'featured_image'        => __( 'Featured Image', '_scorch' ),
    'set_featured_image'    => __( 'Set featured image', '_scorch' ),
    'remove_featured_image' => __( 'Remove featured image', '_scorch' ),
    'use_featured_image'    => __( 'Use as featured image', '_scorch' ),
    'insert_into_item'      => __( 'Insert into Job', '_scorch' ),
    'uploaded_to_this_item' => __( 'Uploaded to this Job', '_scorch' ),
    'items_list'            => __( 'Jobs list', '_scorch' ),
    'items_list_navigation' => __( 'Jobs list navigation', '_scorch' ),
    'filter_items_list'     => __( 'Filter jobs list', '_scorch' ),
);
$args = array(
    'label'                 => __( 'Job', '_scorch' ),
    'description'           => __( 'Create a Job Listing', '_scorch' ),
    'labels'                => $labels,
    'supports'              => array( 'title', 'editor', 'thumbnail', 'page-attributes', ),
    'taxonomies'            => array( 'category', 'post_tag' ),
    'hierarchical'          => false,
    'public'                => true,
    'show_ui'               => true,
    'show_in_menu'          => true,
    'menu_position'         => 5,
    'menu_icon'             => 'dashicons-list-view',
    '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( 'job', $args );

} add_action('init','Job',0);

}

这是在侧边栏中调用与自定义帖子类型相关的类别:

<div class="job-cat"><?php the_category() ?></div>

希望有人知道我在这里缺少什么 . 谢谢!