Skip to main content
2 of 2
added 43 characters in body
Behseini
  • 525
  • 2
  • 9
  • 25

Cant' Grab WordPress Built-in Posts Through Loop

Using WordPress 3.7.1 I am trying to display all Regular Post on my created page lest say TestPage. Here are the steps I took to do this:

1- Generate a Custom Page Template called:Test Page and loaded by following code
2- Generate a Page Called TestPage based on Test Page Template

after updating the page I am not getting any of Post on the page while I have already generated some!

<?php
/*
Template Name: Test Page
*/
?>
<?php get_header(); ?>

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <h1><?php the_title() ;?></h1>  
    <?php the_content(); ?>
<?php endwhile; else: ?>
    <p>Sorry, this page does not exist</p>
<?php endif; ?>

<?php get_footer(); ?>

he abouve code actually is loading the page whit title and content of the TestPage and not by Posts!Can you please let me know why this is happening?

Behseini
  • 525
  • 2
  • 9
  • 25