WordPress – ‘The Loop’ to show all posts, instead posts the title of the home page

I’ve been programming for a few years now but I just started with wordpress. Started with a tutorial series and one of the first things it does was make a simple “the loop”, to print the title and description of all of the posts. When I did it though, it prints the name and description of the home page.

<?php 
if ( have_posts() ) 
 {
  while ( have_posts() ) 
    {
        the_post(); 
        the_title('<h2><a href="the_permalink();"','</a></h2>');   
        the_content(); 
        // Post Content here
        //
    } // end while
 } // end if
?>

I looked around a ton, compared it to other examples and I cannot figure out why it prints the home page information instead of post info.

Read more here: WordPress – ‘The Loop’ to show all posts, instead posts the title of the home page

Leave a Reply

Your email address will not be published. Required fields are marked *