Hello! The people, I need your help, he was already tortured. I make a site on wordpress, there is a main page and there is a page of records. Accordingly, I want the records to be displayed on the page of records, but I can’t do it in any way.

What is available. I created page.php (I tried it differently, and page-blog.php and page-news.php) put this code with the comment Template name: News in it .

<?php /* Template name: News */ get_header(); ?> <?php if (have_posts()): while(have_posts()): the_post(); ?> <div> <a href="#" class="list-item--link"><?php the_title() ?></a> <div><?php the_date() ?></div> <div><?php the_content() ?></div> </div> <?php endwhile; ?> <?php else: ?> новостей нету <?php endif; ?> <?php get_footer(); ?> 

Then I created a page with the name Blog and the blog label and set the template for it that I created enter image description here enter image description here

Then in the settings I chose a static page for blog entries: enter image description here

Saved all this and all the same, when I go to the link localhost / site / blog, I see the main page, instead of the page of records. Why? What am I doing wrong?

    2 answers 2

    when I follow the link localhost / site / blog, I see the main page, instead of the page of records. Why? What am I doing wrong?

    There is no loop in the pattern.

      The page of entries is displayed by the home.php template, you just need to transfer the code from your page.php to this file and everything should work.

      In the absence of the home.php file, the home.php starts working, if the code for the main page is in this file, this may explain that instead of a page of records, you display the content that you expect to see only on the main page