Part 3 – “Photoshop to XHTML in 24 Hours”
Part 4 – “Cleaning Up Your XHTML”
Part 6 – “Marking Up is Hard to Do” and “The Anatomy of a WordPress Theme”
Part 7 – “Beginning with PHP for WordPress”
Part 8 – “Putting the Press in WordPress with PHP”
Part 9 – “Marking Up Header.php, Footer.php and Sidebar.php”
So far we’ve made a ton of progress with our theme design. We designed it in Photoshop, we converted to XHTML and then we began the somewhat tedious task of adding PHP. Now that we’ve created index.php, header.php, footer.php and sidebar.php, we can move on to creating the rest of the theme.
In “The Anatomy of a WordPress Theme” we noted that WordPress needs certain files for your theme to function properly. Here’s that list again:
- 404 Template = 404.php
Archive Template= archive.php Archive Index Page= archives.php
- Comments Template = comments.php
- Footer Template = footer.php
- Header Template = header.php
- Links = links.php
- Main Template = index.php
- Page Template = page.php
Popup Comments Template= comments-popup.php
- Post Template = single.php
Search Form= searchform.php Search Template= search.php
- Sidebar Template = sidebar.php
- Stylesheet = style.css
As you may have noticed, the items listed in bold are the only items we’ve created in our lessons thus far and there is still a lot of work to be done! Anything
struck through is optional therefore this lesson won’t cover it but I have linked to pages where you can read about them on your own. While I can’t go into complete detail I will highlight some major points about each and then I’ll give you links to four sites that break the process down in detail and more thoroughly:
Single.php is the file referenced when someone clicks on the permalink for one of your posts. Thus it is the template for displaying a single post on your blog. On most blogs single.php an index.php are very similar except that in addition to querying <? the content(); ?> we also have to query the comments page. We do this just before we close the loop with:
<?php comments_template(); ?>
Page.php is the template for any page in your theme that doesn’t have it’s own .php template or that is not a blog entry. This is also the template for the static “Pages” that you create within the WordPress Admin panel. It is usually also just like index.php except that it doesn’t include the loop or the_content().
Ignores Page content and instead displays your links using get_links_list.
Where you users land when they follow a bad link on your blog or click through to something that’s been removed. Codex offers some advice….
While you work hard to make sure that every link actually goes to a specific web page on your site, there is always a chance that a link clicked will slam dunk and become a famous 404 ERROR PAGE NOT FOUND. Some errors are avoidable, you should regularly check and double check all your links. Also, if you are deleting a popular but out-of-date post, consider deleting the body of the post, and replacing it with a link referring visitors to the new page.
This concludes “Designing and Coding a WordPress theme from Scratch” . This guide was written as a starting point and a reference guide I can always be contacted at jongos [at] gmail if you are having trouble or need advice. Alternatively I’ve compiled a list of resources that I often reference when creating themes below.
In this tutorial I mentioned a theme that I was developing quite a bit. You can download it along with the PSD used to create it here. Keep in mind that the version you’re downloading is an early beta release. It’s bulky, clunky, not very pretty under the covers and has a mind of it’s own so I’m dubbing it the Rosie O Donnell release. Feel free to give me feedback on it, use it to double check your own code, or modify it to suit your needs.
DOWNLOAD THE AQUA MARINA WORDPRESS THEME
Recommended Further Reading