Bug fixing your WordPress website

  • Home / Bug fixing your WordPress website

Bug fixing your WordPress website

You find and install your favorite WordPress theme and couple of necessary plugins. And to match your exact need and implement your own design you made a few quick and simple changes to the theme files. You fire up the editor and put custom code on it and press save. Bang ! You got a white screen of death and your site gone forever. Congratulation. You just break your WordPress web site.

It’s a very common scenario for newbie developers as well as developers like me! Actually it happens all of us. I design and develop website powered by WordPress and it happens several times to me. The pick point is, when you break your website you must learn how to fix it and wise men says learn from your failure not from your success.

“But I did it everything right and what the hell is wrong with the theme?”

Well, don’t panic. Keep reading the article and follow the guideline. I’m going to present you some very common problems and how to fix them.

Issue-1: Always troubleshoot your theme files with W3C validator

W3C stands for Word Wide Web Consortium and they promotes the web standards and provide a bunch of tools to help you with the facts. For the mark up validation I’d like to introduce the W3C markup validator . When you first land to the site, you’ll find the address textbox and a “check” button. Paste your site URL in the textbox and click “Check”. But personally I’d like to advise you to click on the “More Options” just below the address textbox. It will allows you to use bunch of options to enable you to see error messages links to the corresponding source code. Which is eventually easier to inspect what’s going wrong.

There is also CSS validators to enables you find CSS errors in your CSS files.


Issue-2: Inspect your website with firebug

Firebug is an excellent debugging tool that comes with both firefox and chrome browser. And it let you inspect html, CSS and JavaScript on your web site. It also allows you to manipulate DOM and write CSS and JavaScript on the fly. There are plenty of videos in youtube on firebug about how to use it. Bellow here are the ideal cases when you should use firebug.

Want to check and make a test on how specific CSS looks on your website ? Instead digging into the style.css file use firebug to write and test CSS code on the fly.
Let’s say you messed up with the html code or your theme function generates buggy html code. Use firebug to manipulate the specific DOM tree and test the page lively.
You added a new piece of JavaScript code to your script and that triggers a wrong DOM event and it’s not working correctly. Don’t worry firebug comes to the rescue and it allows you to easily figure out what’s wrong with the JavaScript code.

Issue-3: CSS are not applied properly to the pages

You added some css to the style.css or custom.css for your own and that is not working. If you are using your own css file then make sure that they are loaded properly on the header. Always load the CSS or JavaScript file before the wp_head() hook. Also check for the semi-colon (“;”) at the very end of the property value pair. Also make sure that there are no spell mistakes.

Issue-4: Edited function.php file and site shows error message

When you add your own code to the theme’s function.php file, a tiny mistake can completely blow your site. Happens several times when I started learning WordPress coding J below are the facts that you must consider when pushing your own code in function.php file.

Never ever add white spaces after the code has finished on your function.php file. It will blow your site. Also do not close the closing php tag. PHP 5.3 is smarter and it doesn’t require that.
Also when an error is thrown it always comes with a parse error or warning something like this :
Parse error:
syntax error, unexpected T_STRING in /path_to_your_thesis_folder / functions.php on line 25

syntax error, unexpected T_STRING in /path_to_your_thesis_folder / functions.php on line 25
This error message may sounds like gibberish and scary but you are committed to fix it and want your site back! Well, it may looks scary but it holds a lot of information and it will help you to make your site back. Ok, so what does the error means actually? Honestly speaking parsing errors means you just make a syntax mistake on the specific line while creating your PHP functions. Most possibly an end of semi-colon or a missing curly brasses.
Another type of error may be: Fatal error: Call to undefined function function_name() in /path_to_your_thesis_folder/ functions.php on line 45 . It means you requested a function that doesn’t exists! It actually happens when you misspelled the function name or you use a function from a specific plugin that is deactivated. To fix this error remove the offending code and always call the function using the following conversion:

If (function_exists(‘function_name’)) function_name(); to call the function, instead of just Function_name(); By using that you function will only called if that exists.

If you still can’t solve your problems and the above solutions are not somehow helping you. Google it. It’s you best friend. Learn how to use it. That’s enough education today.

Note: You can visit our main site for Outsource your WordPress Development Projects.

Leave Comments

Contact Us