A Great Tutorial On Theme Development

I completed the Ian Stewart part of The ThemeShaper WordPress Theme Tutorial: 2nd Edition tutorial the other day. It was really helpful, but what I learned most clearly was – I still have a lot to learn.

I’ve seen so many API calls and little WordPress nuances over the past couple days, I realize it’s going to take me a long while to gain fluency in theme development.

I mean, I can now stumble my way awkwardly through building a template, but I don’t yet know theme development. I don’t feel it.

What I Learned

This tutorial may be the best WordPress tutorial I’ve worked through to date. It was thorough and explained everything very clearly. Additionally, it is based on _s, so it was very relevant to the path I’ve already started to take with theme development.

While going through this tutorial I worked on everything from a standard file/directory structure to posts and custom 404 pages to search templates, sidebar templates, the index.phpfunctions.php, and more.

I skipped the comments template partly because Ian made it sound overwhelming and unpleasant, and because, well, I’m not yet doing anything with comments on this site.

Overall, this has proven to be a useful endeavor. The one thing that irritates me just a little is the apparent love affair with <?php?>. I mean, come on, what’s the deal? Why so many opening and closing tags? What’s the benefit I’m not seeing?

For example, take a look at this:

<?php if ( have_posts() ) : ?>
    <php shape_content_nav( 'nav-above' ); ?>
    
    <php /* Start the Loop */ ?>
    <php while ( have_posts() ) : the_post(); ?>

        <php
            /* Include the Post-Format-specific template for the content.
             * If you want to overload this in a child theme then include a file
             * called content-____.php (where ____ is the Post Format name) and that will be used instead.
             */
            get_template_part( 'content', get_post_format() );
        ?>

    <php endwhile; ?>

    <php shape_content_nav( 'nav-below' ); ?>
<php endif; ?>

Shouldn’t that be written within one set of opening and closing php tags versus eight? Is this a WordPress coding standard I missed? It does seem to be common practice in WordPress.

I briefly looked around for thoughts on this and it seems others have asked the same question and the basic answer is… it’s all about personal style.

Well, I think there must be a better answer out there and, perhaps, I’ll go look for it some day. In the meantime, I think I’ll add PHP Best Practices and PHP: The Right Way to my reading list.

But before going much further with WordPress dev, I realize I really do need to start focusing on CSS.

The big question is: Where, oh where do I start?

Follow me on Twitter: @amelungc