Development,  WordPress

Let’s build WordPress theme – part 2

All right now, as you may remember in previous part we have already built WordPress theme but at this point, it is completely terrible and useless. However, we can see posts and this is it. Today we will do a little more. Let’s start.

 HTML Declaration

We will use HTML5, so we leave Doc Type declaration as it is. But we have to take care about browsers (especially older versions of Internet Explorer) and we need to set proper language attribute. Because we do not know which WordPress language version will be used by the user, we need to use language_attributes() function. Then we have to use some conditional comments in HTML, to make sure that proper class will be used to HTML declaration, depending on what IE version is in use. This may look like this:

Head Section

Char set declaration

First of all, char set declaration. In most cases this is simply UTF-8, but what will happen if we are wrong? No special characters, only garbage on the screen. We want to avoid that, for sure. Let’s declare char set using WordPress settings:

View port and initial scale

We won’t touch it at this point, because WordPress itself didn’t gave us anything to set here.

Ping back url

We can add ping back (or track back) url to our site. It may improve WordPress position at search engines results page, it may not. It is all up to you, we will add it here:

Learn more about ping / track backs at WordPress Codex page.

Body declaration

In body declaration we have to print classes, because some of the plug-ins and WordPress itself may add specific classes. It is pretty simple, it looks like this:

And this is it. The rest of the files won’t be changed, except maybe style.css – we will change version mark to 0.1.2. Those all changes won’t modify the way our theme looks. But it is a big step to integrate our code with WordPress. Here you can download booyah-0.1.2.


Leave a Reply

Your email address will not be published. Required fields are marked *