Theme Lab

  • Contact
  • Advertise
  • About
  • Sitemap
  • Resources
  • Forums
  • Tutorials
  • Free Themes
  • Home

Recent Tutorials

  • Add Gravatar Support to Your WordPress Comments
  • Make a Sitemap Page For Your WordPress Blog
  • Easily Add Videos to Your WordPress Blogs
  • How To Make a WordPress Privacy Policy
  • You Don’t Need a Blog On Your Front Page

Subscribe


Search Our Archives

Article Categories

  • bbPress (1)
  • Free Theme Releases (59)
  • Ported Themes (41)
  • Site News (15)
  • Theme Lab Showcase (1)
  • WordPress Community (6)
  • WordPress News (5)
  • WordPress Plugins (11)
  • WordPress Tutorials (26)

Recent Themes

  • Stylevantage - Free WordPress Theme
  • WP Garden - Free WordPress Theme
  • Green and Brown - Free WordPress Theme
  • Orbital - Free WordPress Theme
  • Choice - Free WordPress Theme

Tag Cloud

asides Ben Swift black blue bright brown classy clean colorful dark DemusDesign edg3 elegant featured post FreeCSS glossy gold gray green Hive Designs khaki left sidebar light minimalistic Nuvio one column orange pink purple Rambling Soul red right sidebar silver simple sleek Snapp Happy Styleshout SymiSun tan Templatefusion three columns two columns white Writeside yellow

5 Quick Ways to Fix Up Your WordPress Theme

posted in WordPress Tutorials 7 Comments

Let’s face it, not all WordPress themes are coded perfectly (*cough* not even mine *cough*). Theme designers may forget to add little bits of code that may cause undue stress for the theme user.

Poorly coded themes may cause feed readers to not recognize WordPress’ RSS/Atom feeds. They may cause certain plugins to be rendered useless. They can even cause an entire site to break, likely forcing the WordPress user to switch back to an older theme.

In this tutorial I’ll go over 5 things some theme users and designers alike can do to fix common WordPress theme related issues.

Header and Footer hooks

These two quick bits of code 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 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.

The wp_head() hook

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

<?php wp_footer(); ?>
Although not as widely used among 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.

The wp_footer() hook

Very similar to wp_head() - as shown above.

Links to your feeds

Without these, some feed readers may have trouble recognizing the feed available on your WordPress site. The following codes should be in your header somewhere, between the <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.

RSS 2.0

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

RSS 0.92

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

Atom

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

You can 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 advantage of WordPress’ built-in “pinging” 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 felt this could all 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.

Language Attributes, HTML Type, Charset

<!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

We’ll save the easiest for last. I know this is something you would only have to update once a 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.

Conclusion

That’s about it. Hope this tutorial was of use to you. It’s definitely a good idea to make sure your theme has all of the above implemented. These 5 quick things will take a few minutes to add if not present already. The header and footer hooks are especially important for plugin compatibility. Feel free to comment and share if you liked it. Looking forward to hearing your feedback.

  • Subscribe to RSS
  • E-mail
  •  
  • By: Leland on Apr. 22
  • Bookmark and Share
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • StumbleUpon
  • Technorati
  • Reddit
  • Propeller

SEO Diva says:

posted on April 22, 2008 1:28 pm

Great post - I didn’t know any of this. I’m off to check on my blog now.

Vivevtvivas says:

posted on April 22, 2008 3:06 pm

I’m always looking for any tips I can find on how to improve my templates and blog. I appreciate the time you took to write this! Good stuff, I’m going to link to you in my blog shortly.

Thanks,

Vivevtvivas

Leland says:

posted on April 22, 2008 3:09 pm

@SEO Diva: No problem!

@Vivevtvivas: Thanks, that would be greatly appreciated. :)

Vivevtvivas says:

posted on April 22, 2008 3:31 pm

Hey, we all have to stick together! Here is the link to the article that I wrote: Link

Deborah says:

posted on April 30, 2008 7:53 pm

Thanks for the great tips. I had added the wp_head in the header, but didn’t know about the wp_footer. There’s a small typo in your Atom feed, an extra space after the href=”.

Trackbacks

  • » Ways to Fix Up Your Wordpress Blog Theme » My Online Marketing Experiences pinged this post.
  • Ultime dal fronte WordPress 17-2008 pinged this post.

Leave a Comment

Name:*

Email:*

Website:

Comment:


Sponsors

Free wordpress themes Revolution Theme PowerTheme XHTML Valid Advertise Here

Featured Theme

WP Multiflex 5
WP Multiflex 5

Top Downloaded

  • Transmission (4,602 hits)
  • Colourise (2,277 hits)
  • WP Multiflex 5 (2,088 hits)
  • WP SymiSun (2,044 hits)
  • Simply AIO (1,438 hits)

Blogroll

  • Free CSS Templates
  • Free Photoshop Brushes
  • iPeterBrown
  • Make Money Blogging
  • Rambling Soul
  • Ty’s Blogging Tips
  • UK2 Web Hosting and Blog
  • WordPress Design
  • wpPotential
  • XHTML Valid
  • Vote for us as at Favelets
All material copyright © 2008 Theme Lab.
Powered by WordPress | Terms of Service | Privacy Policy