您尝试访问的页面或广告列表不再存在或已过期

时间:2018-01-28 作者:martin

我在这里有这个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.phptaxonomy-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

1 个回复
SO网友:Vlad Olaru

我已经测试了你的代码,它运行得很好。我认为您缺少的是刷新永久链接,方法是转到WP Admin->Settings->permalinks,然后单击Save Changes.

结束

相关推荐

Custom archives function

我正在为我的教会网站建立一个自定义档案页面。在我的档案页上,我想把上周的布道放在一个特殊的盒子里,然后是未来的布道,最后是布道档案。我希望将来的布道和布道档案用标题隔开。。。i、 未来的布道布道档案布道档案。。。我的问题是,当我用分页功能点击按钮转到旧的布道帖子时,它会在我所在的每个归档页面上显示当前和未来的布道!如何使当前和未来的布道仅显示在第1页上,而不在单击查看旧帖子时显示?以下是我的功能:// Create the loop for the sermons page function se