Получение 404 страницы при нажатии на категории пользовательских типов сообщений - PullRequest
0 голосов
/ 25 января 2020

Привет. Каждый, кого я создал, имеет свой тип поста с адресом ниже.

/* readings Post Type */
if ( !function_exists('readings_category_register') ) {
        function readings_category_register() {
            $readings_permalinks = get_option( 'readings_permalinks' );
            $args = array(
                "label"                         => __('Topics'),
                "singular_label"                => __('Topic'),
                'public'                        => true,
                'hierarchical'                  => true,
                'show_ui'                       => true,
                'show_in_nav_menus'             => false,
                'args'                          => array( 'orderby' => 'term_order' ),
                'rewrite'           => array(
                    'slug'       => empty( $readings_permalinks['category_base'] ) ? __( 'readings-category' ) : __( $readings_permalinks['category_base']   ),
                    'with_front' => false
                ),
                'query_var'         => true
            );
            register_taxonomy( 'readings-category', 'readings', $args );
        }
        add_action( 'init', 'readings_category_register' );
    }
    /* readings POST TYPE
    ================================================== */
    if ( !function_exists('readings_register') ) {
        function readings_register() {
            $readings_permalinks = get_option( 'readings_permalinks' );
            $readings_permalink  = empty( $readings_permalinks['readings_base'] ) ? __( 'readings' ) : __( $readings_permalinks['readings_base']  );
            $labels = array(
                'name' => __('readings'),
                'singular_name' => __('readings'),
                'add_new' => __('Add New readings'),
                'add_new_item' => __('Add New readings'),
                'edit_item' => __('Edit readings'),
                'new_item' => __('New readings'),
                'view_item' => __('View readingss'),
                'search_items' => __('Search readings'),
                'not_found' =>  __('No readingss have been added yet'),
                'not_found_in_trash' => __('Nothing found in Trash'),
                'parent_item_colon' => ''
            );
            $args = array(
                'labels'            => $labels,
                'public'            => true,
                'show_ui'           => true,
                'show_in_menu'      => true,
                'show_in_nav_menus' => true,
                'menu_icon'=> 'dashicons-groups',
                'rewrite'           => $readings_permalink != "readings" ? array(
                    'slug'       => untrailingslashit( $readings_permalink ),
                    'with_front' => false,
                    'feeds'      => true
                )
                    : false,
               // 'supports' => array('title', 'editor'),
               'show_in_rest' => true,
               'supports' => array('title','editor', 'author', 'thumbnail', 'excerpt', 'comments','categories'),
                //"taxonomies" => [ "readings-category" ],
                'has_archive' => true,
                'taxonomies' => array('readings-category')
            );
            register_post_type( 'readings', $args );
        }
        add_action( 'init', 'readings_register' );
    }
    /* readings POST TYPE COLUMNS
    ================================================== */
    if ( !function_exists('readings_edit_columns') ) {
        function readings_edit_columns($columns){
            $columns = array(
                "cb" => "<input type=\"checkbox\" />",
                "title" => __("readings Name"),
                "description" => __("readings Description"),
                "readings-category" => __("readings Category")
            );
            return $columns;
        }
        add_filter("manage_edit-readings_columns", "readings_edit_columns");
    } ?>

Я также показываю категории на странице. Но когда я нажимаю на категории и они дают мне страницу 404, пожалуйста, помогите мне, как создать пользовательскую страницу, которая будет отображать мои сообщения или категорию в соответствии с моим дизайном. и каким будет имя файла, в котором будут отображаться записи категории пользовательских типов сообщений, например archive-post_type. php вот так.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...