Пользовательский тип сообщения Архив и перенаправление одной страницы на главную страницу - PullRequest
0 голосов
/ 18 июня 2019

Мой пользовательский тип записи работал нормально на WordPress 4.9, поэтому я обновил до 5.2, и теперь он не работает.

Это страница, на которой внизу находится слайдер с отзывами, нажав на ссылку «Читать далее», перенаправляет обратно на домашнюю страницу: https://openlibrary.ecampusontario.ca/

Я много раз менял настройки Постоянных ссылок, но не везет.


class testimonial {

    function __construct() {
        add_action('init',array($this,'create_post_type'));
        add_action('init',array($this,'create_taxonomies'));
    }


    function create_post_type() {
        $labels = array(
            'name'               => 'Testimonials',
            'singular_name'      => 'Testimonial',
            'menu_name'          => 'Testimonials',
            'name_admin_bar'     => 'Testimonial',
            'add_new'            => 'Add New',
            'add_new_item'       => 'Add New Testimonial',
            'new_item'           => 'New Testimonial',
            'edit_item'          => 'Edit Testimonial',
            'view_item'          => 'View Testimonial',
            'all_items'          => 'All Testimonials',
            'search_items'       => 'Search Testimonials',
            'parent_item_colon'  => 'Parent Testimonial',
            'not_found'          => 'No Testimonials Found',
            'not_found_in_trash' => 'No Testimonials Found in Trash'
        );

        $args = array(
            'labels'              => $labels,
            'public'              => true,
            'exclude_from_search' => false,
            'publicly_queryable'  => true,
            'show_ui'             => true,
            'show_in_nav_menus'   => true,
            'show_in_menu'        => true,
            'show_in_admin_bar'   => true,
            'menu_position'       => 5,
            'menu_icon'           => 'dashicons-admin-appearance',
            'capability_type'     => 'post',
            'hierarchical'        => false,
            'supports'            => array( 'title', 'editor', 'author', 'excerpt', 'custom-fields'),
            'has_archive'         => true,
            'rewrite'             => array( 'slug' => 'testimonials' ),
            'query_var'           => true
        );

        register_post_type( 'testimonial', $args );
    }

    function create_taxonomies() {

        // Add a taxonomy like categories
        $labels = array(
            'name'              => 'Types',
            'singular_name'     => 'Type',
            'search_items'      => 'Search Types',
            'all_items'         => 'All Types',
            'parent_item'       => 'Parent Type',
            'parent_item_colon' => 'Parent Type:',
            'edit_item'         => 'Edit Type',
            'update_item'       => 'Update Type',
            'add_new_item'      => 'Add New Type',
            'new_item_name'     => 'New Type Name',
            'menu_name'         => 'Types',
        );

        $args = array(
            'hierarchical'      => true,
            'labels'            => $labels,
            'show_ui'           => true,
            'show_admin_column' => true,
            'query_var'         => true,
            'rewrite'           => array( 'slug' => 'type' ),
        );

        register_taxonomy('testimonial_type',array('testimonial'),$args);

        // Add a taxonomy like tags
        $labels = array(
            'name'                       => 'Tags',
            'singular_name'              => 'Tag',
            'search_items'               => 'Tags',
            'popular_items'              => 'Popular Tags',
            'all_items'                  => 'All Tags',
            'parent_item'                => null,
            'parent_item_colon'          => null,
            'edit_item'                  => 'Edit Tag',
            'update_item'                => 'Update Tag',
            'add_new_item'               => 'Add New Tag',
            'new_item_name'              => 'New Tag Name',
            'separate_items_with_commas' => 'Separate Tags with commas',
            'add_or_remove_items'        => 'Add or remove Tags',
            'choose_from_most_used'      => 'Choose from most used Tags',
            'not_found'                  => 'No Tags found',
            'menu_name'                  => 'Tags',
        );

        $args = array(
            'hierarchical'          => false,
            'labels'                => $labels,
            'show_ui'               => true,
            'show_admin_column'     => true,
            'update_count_callback' => '_update_post_term_count',
            'query_var'             => true,
            'rewrite'               => array( 'slug' => 'tag' ),
        );

        register_taxonomy('testimonial_tag','testimonial',$args);
    }
}

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