Even You

Can Debug


WordCamp Birmingham 2014

Introduction


Hi, I'm Brian DiChiara, Freelance Web Developer



http://briandichiara.com


@solepixel


What Is Debugging?


The process of
identifying and removing errors
from computer software


What is the Problem?


  • It's not working.
  • I get an error.
  • It doesn't look right.
  • It's doing something funky.

Help me help you


  • What specifically is not working?
  • Can you please tell me the error message you are getting?
  • What are you expecting to happen?
  • What about it makes you think it's doing something funky?

Gather Data

  • Steps to Reproduce!
  • Browser/OS
  • What is the URL?
  • Authentication Credentials (and test them!)
  • Screenshot

Locate the problem



  • Switch to another theme (Twenty Fourteen)
  • Disable Plugins


USE A STAGING SITE


Hosts



Setup Your Own:




staging1.domain.com
domain.staging.company.com
  • WP Engine
  • Site Ground

My Ideal Setup

1.  Private Repo in BitBucket
  • At minimum Dev, Staging, and Master Branch
  • Ignore wp-config.php and wp-content/uploads

2.  Setup Locally, using AMPPS, XAMPP, MAMP Pro, or a custom *AMP setup.
  • Host file and VirtualHosts in Apache
  • Local Database and DB String Replace
    • SQLYog (Windows) or Sequel Pro (Mac)
    • Match wp-config.php

3.  FTPloy


Tools of the trade

Editors/IDEs

In-line Debugger



Debugging Resources

Plugins


3rd Party Applications

Nitty Gritty


OuTPUT Variables



  • console.log()
  • alert()


Last Resort


die('1');

Pink Sombrero


Disclaimer: Cowboy coding (or live site debugging)
is looked down upon and is the worst way
to debug a website.

$_SERVER['REMOTE_ADDR']
$_SERVER['HTTP_X_FORWARDED_FOR']

Check against your IP address!


Rubber Ducks!




The End



Any Questions?

Other Resources


WordPress Codex

Mario Peshev (@no_fear_inc)
WordSesh
WP Realm Article

Mo Jangda (Toronto)
Debugging for WordPress Developers



THank you!



briandichiara.com

@solepixel

Made with Slides.com