Now that you have installed a new wordpress theme, I’m sure some of you are thinking - “Gee, why can’t I do ‘this’ with one theme which I can ‘do’ with the other theme” or “how can i change the header of this theme with my own banner” etc. Sometimes you might even find *bugs* in your theme which may cause undue stress to you.

For instance - Some Poorly coded themes (usually the ones which doesn’t update regularly) may cause feed readers to not recognize WordPress’ RSS/Atom feeds. They may also cause certain plugins to become just useless. They can even cause your entire site to break down which is likely going to force you to switch back to an older theme that you really hated.In this tutorial I’ll go over 5 most important wordpress theme related issues that most WordPress theme users encounters and ways to go over and fix them.

Wordpress Header and Footer

The following are the two simple lines of code that should go in the header and footer of your theme. While these aren’t absolutely essential, several well known WordPress plugins simply won’t work at all without them. They’re so easy to add in a theme, why not?

<?php wp_head(); ?>

This piece of code should be placed right before the closing </head> tag. It is used by plugins such as ShareThis to insert things like CSS stylesheets or javascript code directly in your header. Let’s take a look at the code in header.php of the default WordPress theme.

Wordpress Header

As you can see, it is placed directly before the </head> tag.

<?php wp_footer(); ?>

Although not as widely used among the common plugins as <?php wp_head(); ?>, this has a similar role, except instead for the header - it’s for the footer. This is usually placed directly before the </body> tag in your themes.

Wordpress Footer

Links to your Content Feeds

Without these codes, some feed readers may have trouble recognizing the feed available on your WordPress blog. The following codes should be placed in your header between the <head> … </head> tags. You can pick and choose which feeds you want supported. Most prefer the RSS 2, but it won’t hurt to add the others in too!

RSS 2.0

<link rel="alternate" type="application/rss xml" title="Subscribe to <?php bloginfo('name'); ?>" href="<?php bloginfo('rss2_url'); ?>" />

Atom

<link rel="alternate" type="application/rss xml" title="Subscribe to <?php bloginfo('name'); ?>" href=" <?php bloginfo('atom_url'); ?>" />

You can always pick and choose which ones you want. The default WordPress theme just has the RSS 2, so you should probably have at least that one.

Pingback URL

To take most advantage of WordPress’ default “ping” function, you’ll need to have the following line within your <head> tags.

<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

This is what lets you send and receive pingbacks from other blogs who may be linking to your content.

Language Attributes, HTML type, and Charset

I think these all could actually fall under one heading, since all of these are located in the same area near the top of your template, in the header. This is useful if your site is in another language and you’re stuck with the English settings.

Wordpress Language Attribute

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

This most likely can be copy and pasted over what you currently have at the top of your header.php file, unless you have another XHTML type (which is currently Transitional).

Using the Current Year

I know this is something you would only have to do once every year, but why worry when you can let WordPress handle it for you? Simply replace the year (2008 for example) with the following code:

<?php echo date('Y');?>

So when 2009 comes around, you won’t have anything to worry about.