Everything is Broken

Physician Heal Thyself: When WordPress Themes go Bad

Just had an irritating couple of hours when I discovered that my WordPress Theme was broken. The sidebar had slipped to underneath the main column, and the background of the main posting area had disappeared. I tried clearing my cache first of all. Then I tried looking at the site in different browsers. It was still broken in IE: although the symptoms were slightly different the sidebar was still misplaced.

OK, time to roll my sleeves up …

I got into the admin interface and tried a few different themes. Now it was getting interesting … it was present on all themes, which means that an upgrade must have altered something in the main code. Some searching around on the WordPress forums didn’t reveal the clammour of angry WP users I was expecting, so I was reduced to searching for generic solutions.

In one post in the darkest corners of the internet I found someone suggesting that a <div> tag wasn’t closed properly. That made sense, so I downloaded the source code for the page and edited that. It seemed that adding a </div> tag immediately before the code which calls the sidebar does the trick. Like this:

<?php get_sidebar(); ?>

Becomes

 </div>
<?php get_sidebar(); ?>

Now the challenge was finding that code. I went into the theme editor and tried a few files (header.php, footer.php and page.php)  before I found what I wanted in the Main Index (index.php). Making the change was the work of seconds and reloading the page meant I was back to normal. You may find this code in different places depending on which template you’re using. In another template I found the code in the footer.php file, and in this case the closing </div> tag was present, but just appeared before the get_sidebar code. The fix for this was just to reverse the two tags.

OK all good. But what actually caused it in the first place? I haven’t altered anything in the templates for several months; after the last upgrade I did, a month or so ago, everything seemed to be OK; after the last post a week ago, everthing seemed to be OK. Strange. And Broken.

This entry was posted on Tuesday, October 21st, 2008 at 11:59 am and is filed under General IT. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

« Getting Wireless to work on a Dell Vostro 1400
Ubuntu Touchpad toggle tweak »

Leave a Reply

CAPTCHA Image CAPTCHA Audio
Refresh Image
  • Recent Posts

    • ClamAV reporting Outdated version
    • Adventures in unbricking a router
    • One Line Guitar Tuner
    • Captcha Madness
    • Ubuntu upgrade 9.04 to 9.10
  • Sing for your supper

  • Static

    • About
    • Privacy Policy
  • Tags

    apathy apple calendar chkconfig collanos cross-platform eee evolution firmware google grub hotspot id card lightning Linux Mandriva notebook partitioning pclinuxos pclinuxos 2008 Philippines power management re-install sane scanner scheduleworld script Security slow sysv-rc-conf thinkpad thunderbird trust ubuntu ultraportable usb virtualisation vmware vpn wifi wireless workspace sharing xsane yahoo zombie
  • Blogroll

    • Datalude
    • Digital Life
    • Engage the World
  • Archives

    • May 2010
    • April 2010
    • March 2010
    • November 2009
    • October 2009
    • June 2009
    • May 2009
    • April 2009
    • February 2009
    • January 2009
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • April 2008
    • March 2008
    • February 2008

Everything is Broken runs on WordPress. Theme by Bob. All content Copyright © Datalude 2008+.