A
A
Alexander Osadchy2020-08-09 20:28:52
WordPress
Alexander Osadchy, 2020-08-09 20:28:52

Why isn't the list of WP posts displayed?

I have a blog page, it has its own template:

5f3031c254f2c957271380.png
5f3031cd90e9f464352404.png
Here is the template code:

if ( have_posts() ) :
        while ( have_posts() ) :
          the_post();
          the_title();
          // get_template_part( 'template-parts/content', 'posts' );
        endwhile; // End of the loop.
      endif;

On purpose, I’m just trying to display the titles ...

But the problem is that on the blog page, instead of the posts, the title of this blog page is displayed:

5f30324de1083181220294.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Litvinenko, 2020-08-09
@DELUX

it doesn't work that way. Please note that when you assign your page as a blog page, you lose the choice of template and the ability to edit it.
At this point the template starts using index.php or if there is home.php.
If you want to use a template with a different name for your blog, such as page-blog.php, then don't designate it as your post page. leave it as it was - Select

O
Orkhan Hasanli, 2020-08-09
@azerphoenix

Hello!
Install the Query Monitor plugin and see what template is connected when viewing the page
. I hope the blog template is named correctly? If not, then read the WP code, the template hierarchy, and the theme development thread.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question