The Secret to Debugging Code: Blog Template / Theme Problems
For the past couple of weeks I’ve been taking advantage of my hiatus from blogging to concentrate on finishing minor tweaks that were necessary to my template / theme.
You might not have noticed, and although these changes may seem relatively minor they are in fact fundamentally important to the design. They were also more difficult to accomplish so I had not bothered to implement them until now.
For example, I moved the MyBlogLog widget over to the sidebar where it belonged. That was the easy part.
I wanted to replace the block by showcasing more of my recent posts with one easy glance on the main page just below the video. The hard part was how to accomplish it and not duplicate the same posts that are shown in the left column. I eventually accomplished it with the help of a plugin.
Funny thing was the next day I noticed some unusual things happening on the post pages. The post was being truncated at the end of the sidebar! Hmm, and to make matters worse it was only happening in IE!
I hadn’t noticed the problem the day before because I made the changes late at night. I like to do template changes at night because that’s when there is less activity on the blog. I was tired at the time and wanted to get to bed so I hadn’t bothered to test it properly. Big mistake!
So the next day I disabled the plugin thinking that would solve the problem, but it was still acting up. Stink!
Because I didn’t notice this until the next day I had temporarily forgotten that I had also moved my statistics tracking code from my header to the bottom of the sidebar. Must be that alzheimer’s thing again.
So could that be it?
I removed the code and it was working fine again! After experimenting around a little I eventually decided to put the code into my footer imemdiately before the </body> tag. My rationale was is if it truncated the post there it wouldn’t really matter because that was the end of the page anyhow.
So guess what? You guessed it, all is working well again!
Baby Steps:
The most important thing that I want to get across in this post is that you should NOT make too many changes at one time. Make just one change and then take your time testing it. Give it at day or so to play around with it before you decide to make any more changes.
Click on all of the links and notice if anything looks strange or out of place. Check it out on the main page as well as the post pages. Scroll all the way down and back up again carefully scrutinizing everything.
Test it in the major browsers like Internet Explorer, Firefox, Opera and Safari. If all looks good, then you can save a backup onto your desktop and make more changes if you want.
But if there is a problem, backtrack over what you recently did. Or in other words take a step backwards by reverting your template back to what it was before you made the last change that screwed up.
Maybe that would entail disabling that last plugin you installed. Or perhaps it’s your code that you messed up. Disabling a plugin is easy, but if it’s your code then it’s probably just a minor syntax error.
For example, perhaps you made some changes to your CSS code. You were trying to indent a paragraph and all hell broke loose. Then just Google and chances are you will find the fix you need.
But if worst comes to worst and you still can’t figure out what went wrong, restore that last backup you made from your desktop. Test it again. If it looks normal then you know it was that last change you made.
BUT the important message here is you should NOT make too many changes at one time. Why? Because it will be harder for you to backtrack and remember what you did that caused the problem in the first place.
Baby steps baby…
UPDATE: Then again sometimes all hell can break loose. After further investigation it’s become clear that I am suffering database issues that are not repairable. I’ve contacted my blog host provider and they will be transferring this blog to a fresh install of Wordpress. So things may be acting even more strangely today. Stay tuned…

What do you think? Leave a Comment and join the conversation...
Be COOL! Grab a Button

7.jpg)
Everything looks and works awesome, even sideways (neck cramp, head on pillow)!
I don’t know how you keep up with having a pre-made template. The control freak inside me makes me build templates from scratch.
(My templates unfortunately are not coded for distribution but I hope to make one just for that purpose in the future)
Over the past few months I’m quite proud of how much I learned and now making new WordPress templates don’t look that hard.
I use Dreamweaver to manage my code and files and I don’t think I’ll ever want to use another program !
Jaffer’s last blog post..April Showers for Blogging
Hi Jaffer. It’s good to hear from you again.
The reason why I started with a “pre-made” template is because I wanted a news magazine style. The bottom line is it would have been too much work starting from scratch and taken away my time from actual blogging. But I have made so many changes to the original code that I feel that it is my own theme now. In fact my blog doesn’t look much like the original at all.
I like to use WeBuilder for coding. It handles everything including html, css, javascripts and php. A very powerful piece of software and inexpensive as well.
Which version of Dreamweaver are you using?
I started with MX a few years ago and then upgraded to Dreamweaver 8 and I’m still using it.
(I had to read a few books before things began to make sense)
Jaffer’s last blog post..April Showers for Blogging
Yes, Dreamweaver can be daunting which is why I recommend using WeBuilder. It’s easy and does so much more than just HTML. You should take a look at it.
I also used MX. My daughter bought a copy from Asia a few years ago. It only cost her $5. It was probably a bootleg because the serial didn’t work
Like the new layout. Much nicer on my eyes… and very inviting to boot. Well done.
Wow, I don’t even recognize your place anymore.
Tica Macha (Teri)’s last blog post..It’s BACK!!!
It’s revered back to the default Kubrick theme !
What happened to your template bloke ? Lost it ?
Hah! Is this still April Fools by any chance? Someone pulled a joke on me that’s for sure.
I contacted my blog host last night to investigate database issues and I woke up today to a different template. Someone must have hit the wrong button.
My heart is still beating … pant, pant, pant. All is well now, at least I think.
I like your theme bloke. You have done great things to make it better than a off the self theme.
Curtis’s last blog post..How Have I Become Both a Skydiver And Garden Lover
Thanks Curtis, which proves you can only please some of the people some of the time
I installed a copy of wordpress on my local drive and I tried to test all the changes locally before uploading to the host. Sometimes some error don’t appear in local drive, only on internet, but, most of the time, it is okay.
It is a bit tedious, but, I think that will help to minimize most of the possible problem.
Asia’h Epperson’s last blog post..You Comment I Follow. Err… Actually I don’t
Or you could install another copy of your theme on a subdomain with your blog host and play with it there.
Tons and tons and tons and tons and tons of sympathy. When I make changes to my own blog, it will look peachy in Firefox but scream AGONY! in IE until I figure out what kind of custom hack will fix that problem.
Just spent 2 hours this morning overhauling the site and let me tell you, “pain” is a complimentary word for the debugging.
Did get it right that your site also defaulted for no apparent reason? That happened with one of my sites as well; I fixed that by copying my current theme into the Default directory.
Data poinst,
Barbara
Barbara Ling’s last blog post..Insane Luxury Music - Party hard with this 5K Jukebox
Indeed, misery loves company
Blog Bloke reply on May 4th, 2008 1:13 pm:
I forgot to include - if one REALLY want to experience soul-searing agony, one can check out how one’s site looks in http://www.anybrowser.com/siteviewer.html .
Truly something that reduces fingernails.
Enjoy,
Barbara
I’ve used that myself.
Blog Bloke reply on May 4th, 2008 1:22 pm: