I got one “front-page.php” that is a static one side page. If I use the WordPress loop to see my latest posts at the front-page.php they all shown up.
Now I want to create a news page so I created a file “page-news.php”. Removed the loop code from front-page and pasted it into page-news. Though, nothing happens.
Loop code:
<?php get_header();?>
<?php
if (have_posts()):
while (have_posts()): the_post();?>
<?php the_title();?>
<?php the_content();?>
<?php
endwhile;
else: echo '<p>no posts were found</p>';
endif;
?>
<?php get_footer();?>
What have I missed?
you need to add wp_Query
the main page is consider a blog page so it have the Query default .
you should add this code before
the this part about
have_posts()
will bedont forget to add
wp_reset_postdata();
at the end so you can use many Query in one page .