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:
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:
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.