#83: Building the WordPress Homepage, Part 2

(Updated on )

We continue porting code over from our static mockup to our WordPress index.php page. We tweak “the loop” a bit to output just what we want.

We get down far enough on the page where WordPress functions like get_sidebar() show up. Predictably, it behaves a lot like get_header() works. It goes and gets the sidebar.php file and plops it’s content into the page right where that function is.

We delete quite a bit of code that was us simulating markup that we get from elsewhere and replace it with functions that end up outputing the same markup. For instance, a whole bunch of markup that made the poll area goes away and we put in wp_polls() which is a function that spits out all the stuff needed to show the poll in our actual WordPress template.

Before getting too excited and looking at our work, we move onto the footer.php file and clean that up. The big important task here is that we need to close any elements that we opened in the header.php file but didn’t close. In our case, it’s just one, the opening tag for <div class="page-wrap"> needs to be closed.

We link up the right scripts in the footer, delete a bunch of v9 specific stuff, and tie up loose ends.

When we do go look at the page, it turns out there are a few display weirdnesses that we have to deal with. We spend the whole end of the video debugging these issues, which turn out to be new places we need to be careful about clearing floats and closing tags.