У меня есть типы постов: 'posts' и 'products'.Эти типы сообщений имеют категории.Мне нужно сделать что-то вроде этого:
/posts/ - archive for posts
/posts/some-category - archive for category posts (and /page/2 for pagination)
/posts/some-post-title - single page for post (default)
/products/ - archive for posts
/products/some-category - archive for category posts (and /page/2 for pagination)
/products/some-product-title - single page for product
У меня также странное поведение.Теперь, если я перехожу к / products /, то это приводит меня к archive-products.php, что хорошо, но когда я перехожу к категории продуктов, это приводит меня к archive.php.
register_post_type( 'products',
array(
'labels' => array(
'name' => __( 'Products' ),
'singular_name' => __( 'Product' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'products'),
'capability_type' => 'post',
'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields' ),
'taxonomies' => array( 'category' ),
)
);