Is my custom post type on function.php
add_action('init', 'create_objects_type');
function create_objects_type() {
register_post_type('objects',
array(
'labels' => array(
'name' => __('Недвижимость'),
'singular_name' => __('Недвижимость'),
'add_new' => __('Добавить Недвижимость'),
'add_new_item' => __('Добавление Недвижимости'),
'edit' => __('Редактировать Недвижимость'),
'edit_item' => __('Редактирование Недвижимости'),
'new_item' => __('Новая Недвижимость'),
'view' => __('Просмотреть Недвижимость'),
'view_item' => __('Просмотреть Недвижимость'),
'search_items' => __('Поиск по Недвижимости'),
'not_found' => __('Пока нет Недвижимости'),
'not_found_in_trash' => __('В корзине нет Недвижимости'),
'menu_name' => __('Недвижимость'),
),
'description' => 'Недвижимость itip',
'public' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'menu_position' => 20,
'menu_icon' => 'dashicons-store',
'capability_type' => 'post',
'map_meta_cap' => true,
'hierarchical' => false,
'supports' => array(
'title',
'page-attributes',
'post-formats',
'custom-fields'
),
// 'taxonomies' => array('category', 'post_tag'),
'has_archive' => true,
'rewrite' => true,
'query_var' => true,
'can_export' => true
)
);
}
And added new taxonomy
function wptp_register_taxonomy() {
register_taxonomy( 'objects_category', 'objects',
array(
'labels' => array(
'name' => 'Article Categories',
'singular_name' => 'Article Category',
'search_items' => 'Search Article Categories',
'all_items' => 'All Article Categories',
'edit_item' => 'Edit Article Categories',
'update_item' => 'Update Article Category',
'add_new_item' => 'Add New Article Category',
'new_item_name' => 'New Article Category Name',
'menu_name' => 'Article Category',
),
'hierarchical' => true,
'sort' => true,
'args' => array( 'orderby' => 'term_order' ),
'show_admin_column' => true
)
);
}
add_action( 'init', 'wptp_register_taxonomy' );
This is navigation in index.php
<?
wp_nav_menu( [
'theme_location' => '',
'menu' => 'Главное Меню',
'container' => false,
'container_class' => '',
'container_id' => '',
'menu_class' => 'main_nav',
'menu_id' => '',
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
'depth' => 0,
'walker' => '',
] );
?>
This is menu in inspector
<ul id="menu-glavnoe-menyu-1" class="main_nav"><li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-19"><a href="http://design/category/kvartiry/">квартиры <span class="count">0</span></a></li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-18"><a href="http://design/category/doma/">дома <span class="count">1</span></a></li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20"><a href="http://design/category/ofisy/">офисы <span class="count">1</span></a></li>
</ul>
Items of menu is categories
I have page taxonomy-objects_category.php
<?php
/*
Template Name: Каталог
*/
?>
<?php get_header();?>
<?php get_footer();?>
When I click to the item of menu wordpress no go to the taxonomy-objects_category.php. He show me page 404.php How I can solve this problem? In this screen you can see hierarchy. Is need to devide posts "objects" in 3 categories: