There are several arbitrary types of records, according to the hierarchy of templates, you need to use archive.php to display archives of these records.
So the problem that is not clear to me is:
2 of the 3 types of records I need are displayed, but the third refuses to do this. The index.php template is connected to the place of the archive.php template and no entries are displayed. Just showing a blank page.
Here are the screenshots of what is happening:
Menu item "Portfolio"
Menu item "Team" This test was carried out by not tricky adding a header with the name of the template to its markup.
Menu items are collected from arbitrary links:
enter image description here
Here is the registration code for entries from function.php :

 /** * Π’ΠΈΠΏ записСй "ΠŸΠΎΡ€Ρ‚Ρ„ΠΎΠ»ΠΈΠΎ" **/ add_action('init', 'portfolio_post'); function portfolio_post(){ register_post_type('portfolio', array( 'description' => 'ДобавляСт Π½ΠΎΠ²Ρ‹Π΅ записи Π² ΠŸΠΎΡ€Ρ‚Ρ„ΠΎΠ»ΠΈΠΎ', 'public' => true, 'hierarchical'=> false, 'has_archive' => true, 'taxonomies' => array('post_tag'), 'supports' => array('title', 'editor', 'thumbnail','excerpt'), 'menu_position' => 4, 'menu_icon' => admin_url() . 'images/portfolio.png', 'labels' => array( 'name' => 'ΠŸΠΎΡ€Ρ‚Ρ„ΠΎΠ»ΠΈΠΎ', 'all_items' => 'ВсС записи', 'add_new' => 'Новая запись', 'add_new_item' => 'Π”ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ Π½ΠΎΠ²ΡƒΡŽ запись' ) )); } /** * Π’ΠΈΠΏ записСй "ΠΊΠΎΠΌΠ°Π½Π΄Π°" **/ add_action('init', 'team'); function team(){ register_post_type('team', array( 'description' => 'ДобавляСт Π½ΠΎΠ²Ρ‹Π΅ записи ΠΊ Π±Π»ΠΎΠΊΡƒ "Команда"', 'public' => true, 'hierarchical'=> false, 'has_archive' => true, 'taxonomies' => array('post_tag'), 'supports' => array('title', 'editor', 'thumbnail','excerpt'), 'menu_position' => 4, 'menu_icon' => admin_url() . 'images/portfolio.png', 'show_in_nav_menus' => true, 'labels' => array( 'name' => 'Команда', 'all_items' => 'Вся ΠΊΠΎΠΌΠ°Π½Π΄Π°', 'add_new' => 'Π”ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ сотрудника', 'add_new_item' => 'Π”ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ Π½ΠΎΠ²ΠΎΠ³ΠΎ сотрудника' ) )); } 

And in one of the templates when accessing WP_Query records of this type are displayed. Here is a piece of code from the template:

 <!--team block--> <?php $team = new WP_Query(array('post_type' => 'team','posts_per_page' => 3, 'orderby' => 'rand')) ?> <section class="teams-block"> <h2 class="teams-block_header"> <span class="teams-block_header_text"> Наша ΠΊΠΎΠΌΠ°Π½Π΄Π° </span> <a class="teams-block_header_link-all" href="<?php echo get_post_type_archive_link( 'team' ); ?>"> / Вся ΠΊΠΎΠΌΠ°Π½Π΄Π° </a> </h2> <div class="teams-block_content"> <?php if ( $team->have_posts() ) : ?> <?php while ( $team->have_posts() ) : $team->the_post(); ?> <div class="teams-block_worker"> <a class="worker_foto" href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a> <h3 class="worker_name"><?php the_title(); ?></h3> <h4 class="worker_specialty"><?php my_list_tags(); ?></h4> <div class="worker_info"> <?php the_excerpt(); ?> </div> </div> <?php endwhile; ?> <?php else: ?> <p>Π±Π»ΠΎΠΊ наша ΠΊΠΎΠΌΠ°Π½Π΄Π°</p> <?php endif; ?> </div> </section> <!--end team block--> 

They are displayed, but the links are:

 <a class="teams-block_header_link-all" href="<?php echo get_post_type_archive_link( 'team' ); ?>"> 

and

 <a class="worker_foto" href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a> 

They send everything to the same notorious index.php without displaying information.
I hope I have described the problem enough and provided all the necessary data to help solve this problem.

    1 answer 1

    Guys who are faced with a similar problem, just do not forget, after registering an arbitrary type of recording, go to the admin panel => settings => permanent links and click the "save changes" button