Support » Themes and Templates » Loop not working correctly

  • I have been making a WordPress from scratch, this the first time for making one. Unfortunately I’ve been stuck for a week on trying to get the Main Index Template to work with the loop. This is the loop

    <?php get_header(); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <?php endwhile; else: ?>
    	<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>
    
    <?php get_footer(); ?>

    This is the home page. What is going on here and why isn’t it working. I would like to understand how this works. I can read PHP and have a fair understanding of it, but I just don’t know what’s going.

    <div id="content">
    <div id="slideshow" class="grid_8">Slideshow?</div><!--end slideshow--> <!--Note to self put slideshow index page-->
    
    <div class="news">
    <h1 class="news">Upcoming Events</h1>
    <!--<h1 class="news">Upcoming Events</h1>-->
     <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer lacinia leo non ipsum dapibus, mattis viverra est blandit. Aenean quis mi eu lorem sollicitudin aliquet ut sed leo. Aliquam quis nibh molestie, scelerisque magna at, auctor nunc. Aliquam rhoncus interdum fermentum. Praesent blandit, lacus et ornare tristique, purus dui pellentesque lacus, non aliquam leo nisi et quam. Praesent cursus elit sed libero dignissim posuere. In sed arcu ac libero consequat convallis ut suscipit felis. Ut sollicitudin purus auctor, dignissim magna ut, ultrices augue. Nam scelerisque porta tempor. Nullam nulla justo, posuere id nisl at, elementum eleifend sem. Phasellus pretium consectetur sem, in dapibus elit viverra vel.</p>
     <div class="btn">Contact Button</div>
    </div><!--end news-->
    <div class="news">
    <h1 class="news">Featured Animal</h1>
     <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer lacinia leo non ipsum dapibus, mattis viverra est blandit. Aenean quis mi eu lorem sollicitudin aliquet ut sed leo. Aliquam quis nibh molestie, scelerisque magna at, auctor nunc. Aliquam rhoncus interdum fermentum. Praesent blandit, lacus et ornare tristique, purus dui pellentesque lacus, non aliquam leo nisi et quam. Praesent cursus elit sed libero dignissim posuere. In sed arcu ac libero consequat convallis ut suscipit felis. Ut sollicitudin purus auctor, dignissim magna ut, ultrices augue. Nam scelerisque porta tempor. Nullam nulla justo, posuere id nisl at, elementum eleifend sem. Phasellus pretium consectetur sem, in dapibus elit viverra vel.</p>
     <div class="btn">Contact Button</div>
    </div><!--end news-->
    </div>

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Loop not working correctly’ is closed to new replies.