With the help of the Option Tree plugin I made the setting for displaying certain rubrics on the main page.
<?php get_header(); $a = 5; ?> <div class="content content-pos"> <div class="row portfolio "> <?php $str_cat = ''; if (!empty(ot_get_option('my_category'))) { // echo '1'; /* get the slider array */ $slides = ot_get_option('my_category', array()); if (!empty($slides)) { foreach ($slides as $slide) { $str_cat = $str_cat . $slide['category_ch'] . ','; } } } $args = array( 'cat' => $str_cat ); $query = new WP_Query($args); if ($query->have_posts()): // для проверки clearfix $clear_md = 0; $clear_sm = 0; ?> <?php while ($query->have_posts()): $query->the_post(); //считаем clearfix $clear_md++; $clear_sm++; ?> <div class="col-md-4 col-sm-6 col-xs-12 nop"> <div class="content__block content__block-pos z-depth-1"> <div class="content__top"> <a href="<?php the_permalink(); ?>" class="content__img content__img-pos"><?php the_post_thumbnail(); ?> </a> <h3 class="content__title content__title-pos"><a href="<?php the_permalink(); ?>" class="" title="<?php the_title(); ?>"><?php the_title() ?></a> </h3> <div class="content__article content__article-pos"><?php the_excerpt() ?></div> </div> <div class="content__bottom"> <div class="divider"></div> <a href="<?php the_permalink(); ?>" class="content__read waves-effect content__read-pos"><span> Read more</span> </a> </div> </div> </div> <?php // вставляем clearfix if ($clear_md % 3 == 0) { echo ' <div class="clearfix visible-md-block visible-lg-block"></div>'; } if ($clear_md % 2 == 0) { echo ' <div class="clearfix visible-sm-block"></div>'; } ?> <?php $start_row++; endwhile; ?> <?php endif; wp_reset_postdata(); ?> </div> </div> <div class="content"> <?php pagination(); ?> </div> <?php get_footer(); ?> I created a separate file with category.php, so that index.php would not interfere with the display of posts in the rubrics page. Column pages work well. But pagination appears on the main page !!! The main page displays only 4 posts (out of 6 allowed), and for some reason pagination appears on the 2nd page, where the same 4 posts. Why did it happen?
{}that's for code. - Naumovpagination()function works for the main request ("main loop"). Your posts are displayed by a special (not the main) request, and this function does not know about them, but it knows about posts that are displayed by default on the main one. Find out exactly where this function is defined and add it to the text of the question, and then we'll see - tutankhamun