Skip to main content
2 of 2
added 364 characters in body
Hans
  • 561
  • 2
  • 8

I'm following your initial question. In your backend, create a page with the title Test 1, which should result in the page slug test-1.

In your child theme folder, create a page template, using the filename page-test-1.php. Wordpress will be loading this template, following this pattern: page-$slug.php. For more details, see here: https://developer.wordpress.org/files/2014/10/wp-hierarchy.png.

In your page template, load the header and footer of your theme and query your posts. By default, Wordpress would display the content of that page, but since you want to display all of your posts, you need a custom query:

<?php
get_header();

$args = [
 'post_type' => 'post',
 'post_status' => 'publish',
 'posts_per_page' => -1
];

$posts = new WP_Query( $args );

while ( $posts->have_posts() ) : $posts->the_post();
 ?>
 <article>
    <?php

    the_title( '<h1>', '</h1>' );
    the_excerpt();

    ?>
 </article>
<?php
endwhile;

get_footer();

Another way would be to go to your settings->reading section and select the page Test 1 as default template for your posts page. However in this case, Wordpress will load the index.php file to show a list of your posts. You could then display all posts with a default loop:

while( have_posts() ) : the_post();
   the_title();
endwhile;
Hans
  • 561
  • 2
  • 8