我在这里有这个URLhttps://www.gundogworld.co.uk/judge/
. 我希望这是一个简单的存档页。在此页面上,它具有body类class="archive post-type-archive post-type-archive-tribe_ext_judge logged-in tribe-js
我拿不到/judge
无论我做什么都要显示档案。mod_rewrite
在服务器上处于活动状态,我关闭了所有缓存,访问了permalink,并在每次尝试后重新保存。在我的孩子主题中archive-judge.php
, single-judge.php
和taxonomy-judge.php
.
这是我在帖子注册的插件中的代码,我已经关闭了所有插件(除了2个必需的插件),并恢复到2016年。我已经尝试了所有我可以阅读谷歌的东西,3周都没有成功!
/**
* Set the arguments for and register the post type.
*
* @link https://developer.wordpress.org/reference/functions/get_post_type_labels/
* @link https://developer.wordpress.org/reference/functions/register_post_type/
*
* @see Linked_Posts::register_linked_post_type()
*/
public function register_our_post_type() {
$post_type_key = self::POST_TYPE_KEY;
$labels = array(
\'name\' => esc_html_x( \'Judges\', \'Post type general name\', \'tribe-ext-judge-linked-post-type\' ),
\'singular_name\' => esc_html_x( \'Judge\', \'Post type singular name\', \'tribe-ext-judge-linked-post-type\' ),
\'singular_name_lowercase\' => esc_html_x( \'judge\', \'Post type singular name\', \'tribe-ext-judge-linked-post-type\' ),
// not part of WP\'s labels but is required by Linked_Posts::register_linked_post_type()
\'add_new\' => esc_html_x( \'Add New\', $post_type_key, \'tribe-ext-judge-linked-post-type\' ),
\'add_new_item\' => esc_html__( \'Add New Judge\', \'tribe-ext-judge-linked-post-type\' ),
\'edit_item\' => esc_html__( \'Edit Judge\', \'tribe-ext-judge-linked-post-type\' ),
\'new_item\' => esc_html__( \'New Judge\', \'tribe-ext-judge-linked-post-type\' ),
\'view_item\' => esc_html__( \'View Judge\', \'tribe-ext-judge-linked-post-type\' ),
\'view_items\' => esc_html__( \'View Judges\', \'tribe-ext-judge-linked-post-type\' ),
\'search_items\' => esc_html__( \'Search Judges\', \'tribe-ext-judge-linked-post-type\' ),
\'not_found\' => esc_html__( \'No judges found\', \'tribe-ext-judge-linked-post-type\' ),
\'not_found_in_trash\' => esc_html__( \'No judges found in Trash\', \'tribe-ext-judge-linked-post-type\' ),
\'all_items\' => esc_html__( \'Judges\', \'tribe-ext-judge-linked-post-type\' ),
\'archives\' => esc_html__( \'Judge Archives\', \'tribe-ext-judge-linked-post-type\' ),
\'insert_into_item\' => esc_html__( \'Insert into judge\', \'tribe-ext-judge-linked-post-type\' ),
\'uploaded_to_this_item\' => esc_html__( \'Uploaded to this judge\', \'tribe-ext-judge-linked-post-type\' ),
\'items_list\' => esc_html__( \'Judges list\', \'tribe-ext-judge-linked-post-type\' ),
\'items_list_navigation\' => esc_html__( \'Judges list navigation\', \'tribe-ext-judge-linked-post-type\' ),
);
$args = array(
\'labels\' => $labels,
\'description\' => esc_html__( \'Judges linked to Events\', \'tribe-ext-judge-linked-post-type\' ),
\'public\' => true,
\'exclude_from_search\' => true,
\'show_in_menu\' => \'edit.php?post_type=\' . Tribe__Events__Main::POSTTYPE,
\'menu_icon\' => \'dashicons-businessman\',
\'capability_type\' => $post_type_key,
\'map_meta_cap\' => true, // must be true for $this->set_our_capabilities() to take effect
\'supports\' => array(
\'author\',
\'editor\',
\'excerpt\',
\'revisions\',
\'thumbnail\',
\'title\',
),
\'has_archive\' => true,
\'rewrite\' => array(
\'slug\' => \'judge\',
\'with_front\' => false,
),
);
register_post_type( $post_type_key, $args );
}
重写规则如下
judge/?$ index.php?post_type=tribe_ext_judge other
(.?.+?)(?:/([0-9]+))?/?$ index.php?pagename=$matches[1]&page=$matches[2] page
([^/]+)(?:/([0-9]+))?/?$ index.php?name=$matches[1]&page=$matches[2] post