Thord Daniel Hedengren - Smashing WordPress_ Beyond the Blog-Wiley (2014)

(avery) #1

82 PART II • Designing and Developing WordPress Themes


<?php get_sidebar(); ?>

</div>

<?php get_footer(); ?>

You’ll remember that these three tags will include the contents from header.php, footer.php,
and sidebar.php.

Next up is getting index.php ready for actually displaying content. To do that, you need the
loop, covered in the previous chapter, “The Loop.” You’ll use the dummy content as a basis for
how the actual output should look. Add the loop, clean out the dummy content, and see how
it looks:

<?php get_header(); ?>

<div id="main-container">
<section id="content-container">

<?php
// Start the loop
if ( have_posts() ) : while ( have_posts() ) : the_post();
?>

<!-- LOOPED CONTENT GOES HERE -->

<?php
// Loop ends
endwhile;
// Nothing in the loop?
else :
?>

<article id="post-0" class="post no-results not-found">
<header>
<h2 class="entry-title">Nothing Found</h2>
</header>
<p>We're sorry, but we couldn't find anything for you. Please try and
search for whatever it was you were looking for.</p>
<?php get_search_form(); ?>
</article>

<?php
// And we're done
endif;
?>

</section> <!-- #main-container ends -->

<?php get_sidebar(); ?>
Free download pdf