October 18, 2017

WordCamp ATX: Jared Atchison

Jared Atchison
Oops! Common WordPress Mistakes

Adding Javascript to themes

Don’t: add javascript code directly into theme files like header.php
Do: use the actions wp_enqueue_script() and wp_register_script(). You can call the javascript just where you need it.

WP packaged jQuery

Do: use the jQuery code that ships with WordPress (or add your own in no-conflict mode)
Don’t: add your own version of jQuery or remove it simply because you don’t know the proper way to inject your script into WordPress. Adding jQuery directly to theme causes lots of conflicts and problems with the way WordPress functions. Most common issue is multiple copies of jQuery running on one WordPress install (especially if plugins are installed.) Also, cross-compatibility can be lost.

Including files

Do:

  • include();
  • require_once();
  • get_header(); get_sidebar; get_footer();

(for more, refer to WordPress codex)

Using Permalinks

You can do almost anything.
Should you do anything? No!!!

Don’t: start page permalinks with %category% or %postname%. Pages + non-numerical starting permalinks = tons of extra rules. (Custom post types excluded.) Read more about what this is bad practice.

Do: Use a numerical reference to start permalink.


Building a theme

Don’t: start from scratch unless you have to.
Do: Build on something that’s proven. A blank theme or framework is a good starting point. You can also build on top of Twenty Ten, the default WordPress theme.

Don’t: build on top of themes that suck!

Troubleshooting (do it!)

Errors? Warnings? Notices? White screen of death?
Don’t panic!

Most problems you can debug yourself.

  • define(‘WP_DEBUG’,true);
    (found in WP-config)
  • deactivate plugins
  • deactivate themes
  • IRC #wordpress on irc.freenet.net
  • 3rd party assistance: WP Tavern, StudioPress forums, Google, Twitter, IRC in WordPress channel
  • Staying informed

    Do: Follow helpful WordPress sites

    (see Jared’s presentation for links)

    Find Jared’s presentation on his website.

    Speak Your Mind

    *