Answer the question
In order to leave comments, you need to log in
How to display WordPress posts on another template?
I display posts on the page in the index.php template using if(have_posts())....etc, everything is displayed normally, but when I try to display posts in the same way only in another template (created by me), then on the page nothing is displayed and posts are not displayed. How can I make posts appear exactly in the template that I need? Tell me please.
Answer the question
In order to leave comments, you need to log in
I figured it out myself. Here is the solution
<?php $all_posts = get_posts();?>
<?php foreach($all_posts as $post): ?>
// выводим посты
<?php endforeach; ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question