There is a blog page, and here I am trying to display posts, but when I write this if ( have_posts() ) : query_post... then the page is empty, nothing is loaded into it at all, I call page-blog.php page maybe a problem? In the admin panel, I go to the Blog page and switch to the Blog template (since we are at the top of page-blog.php. We gave the name of the Blog template.)
page-blog.php
<?php /* Template Name: Blog */ get_header(); ?> <article> <section class="mblog"> <div class="container"> <div class="mblog__wrapper"> <?php if ( have_posts() ) : query_posts('cat=6'); while (have_posts()) : the_post(); ?> <div class="mblog__col"> <a href="<?php the_permalink(); ?>" class="mblog__post-item"> <div class="mblog__post-img-wp js-bg-img"> <?php the_post_thumbnail();?> </div> <div class="mblog__post-title"><?php the_title(); ?></div> <div class="mblog__post-content"><?php the_content(); ?></div> </a> </div> <? endwhile; endif; wp_reset_query(); ?> </div> </div> </section> </article> <?php get_footer(); ?>
query_posts. - Pyramidheadquery_posts- SeVlad