20121201-115822.jpg
20121201-115822.jpg

Best Practices in Theme Development – Orlando WordCamp 2012

| 7 Comments

At the Orlando WordCamp 2012, I sat in on a talk by James Tryon regarding best practices regarding theme development and I wanted to share some of his points, as I think they’re of good value, for anyone who tinkers with themes:

  • Think about workflow: make it obvious how certain tasks are achieved, particularly in the back-end.
  • Your client shouldn’t need you once you turn the site over: everything should be sufficiently obvious that you client can update and maintain their own site.
  • Use _s as your starter theme for custom theme work. It is by far the best way to build a theme without unnecessary duplication of effort.
  • If something adds functionality to a site, it belongs in a plugin, NOT IN A THEME!
  • Learn how to use get_template_part and start using it!
  • Only load functions on the pages they’re needed.
  • If WordPress does it, use it. Don’t reinvent the wheel!
  • Never load CSS or JS in the header or footer directly: use wp_enqueue_script and wp_enqueue_style instead.
  • Use the built-in Theme Options functions for allowing the user to set colors, headers and layout.
  • Put plugins that deliver core site functionality in the mu-plugins folder, so that they can never get deactivated, not from the plugins screen, nor from switching themes.
  • Shortcodes can deliver a lot of custom functionality (custom loops, styled elements) that are easy for clients to remember and use throughout their site, which puts a lot of power in their hands. Consider using them where appropriate.
  • Make sure you use the WordPress Coding Standards (0 – not 0px, media queries at the bottom etc.).
  • You don’t have to design responsively, but at least make sure that it works on mobile devices. If not, fix accordingly.
  • Test with WP_DEBUG to make sure your theme isn’t throwing up any errors. Also think about using BrowserStack for cross-browser testing.
  • Invest in useful premium plugins that will deliver you a lot of customization ability and save you a lot of time, like Gravity Forms.
  • Make sure you compress all of your imagery to improve load time and reduce file size.

So, what did you learn? Or what do you have to add to the list?

You can see James’ slides here and hopefully, the session will make it on to wordpress.tv soon enough

Categories: Resources & News | Permalink

What next?

Hire me

If you couldn't quite manage this yourself, find it too intimidating, or just don't have the time to do it, you can always hire Dave to do it. Please get in touch so that we can discuss your needs.

Leave a comment

If you have a question, update, or comment about the tutorial, please leave a comment. I try and respond to every comment, though it may take a few days, so please check back soon.

Keep your site backed up, updated & secure

I provide a service called The WP Butler, which helps you stay on top of the maintenance of your WordPress site. Instead of worrying about whether your site is secure, updated and backed up, The WP Butler handles all that for you on a regular basis, so that you can focus on doing what you do best. If you use coupon DIWW, you'll save 15% on our already-low-prices for all maintenance plans.

Author: Dave Clements

Dave Clements has been building websites for close to a decade and in 2010, he formalised that by starting his own company, The UK Edge. He now works on a variety of web projects, from simple tasks like installing a new WordPress site, to consulting on problems, or redesigning his clients' sites. He also runs Do It With WordPress, a site dedicated to providing free tutorials on WordPress. When he's not building your new website, you can find Dave eating Wheat Thins, spending time with friends and family, watching Indie films, fostering kittens from the local Humane Society, listening to some dubstep, dance and electronic rock, and exploring the world.

7 Comments

  1. There’re some debates on putting shortcodes in a plugin or theme, and there’re many plugins for that purpose. But in some limits like styling elements (boxes, lists, quotes, etc.) I agree with you that shortcodes should be implemented within themes.

    And I love the _s theme! That’s a great start for building theme. Everyone can learn something from this.

    • Well, I can’t think of a single reason why shortcodes should be included in themes – as soon as the theme changes, all of the content within those shortcodes is broken, or doesn’t display.

      I built my first two themes from _s – it’s a perfect, well-coded and commented starter for anyone.

  2. Thanks for the great Write up. The slides can be found on my site.

    http://easilyamusedinc.com/uncategorized/1544/12/04/2012/best-practices-in-theme-development-wordcamp-orlando-2012/

    @Rilwis If the theme changes the shortcodes will die and all your old blog post will be filled with dead shortcodes. Moving them to a plugin will pervent that from happening.

  3. One thing I don’t necessarily agree with is putting plugins in the mu-plugins folder. If they’re custom plugins that you’ve written, then that’s okay. But putting WordPress.org-hosted plugins in mu-plugins will block updates – and that’s bad.

  4. Am Sorry, am a newbie and I never really got _s concept. I though have heard and seen Stalkers theme in play, where it gives you a bare theme with nothing to work on. Is _s kind of same?

    • Yes, _s is the same in the sense that the theme has absolutely no styling, however, it is completely built out, so all you need to do is add the styling and you’ll have a very functional, well-coded theme.

Leave a Reply