Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CREATING USABLE, MAINTAINABLE, AND UPGRADABLE W...

CREATING USABLE, MAINTAINABLE, AND UPGRADABLE WORDPRESS SITES

You’ll find thousands of tutorials, snippets, and other advice online advising you to “just add this to your functions.php file.”

It’s a bit more complicated than that…
I’LL COVER:
Why that’s rarely the best strategy for anyone (yes, even a non-technical user)
Why developers and designers should never do this on client sites
What best practices are regarding adding custom functionality to your site
Tools for users of all levels to avoid functions.php bloat
I’LL ALSO COVER:
Why “app themes” are probably a bad way to start a business/website
Which code belongs in plugins vs. themes
How using a theme framework/starter theme can save you hassles and headaches

Nick Ciske

April 25, 2015
Tweet

Other Decks in Programming

Transcript

  1. Hacking plugin files •Fork it (preferably on GitHub) •Hack the

    version number or disable auto updates •Document your hack!
  2. Child Themes •Whenever possible! •Starter (_s) vs. Parent Theme (Genesis)

    vs. Frameworks (?) •Can’t? Consider the quality of parent theme… •Use a theme with hooks (and never touch the theme)
  3. Avoiding Bloat •“Just add this snippet to your active functions.php

    …” •functions.php file is for common theme functions •It’s not for site functions. •Should be relatively sparse - include files if you must •Code is Poetry — not the great American novel
  4. Enqueue all the Things? •Only enqueue it when you need

    it •You can enqueue scripts and styles in shortcodes •has_shortcode() (WP 3.9+)
  5. Too many plugins (or not enough?) •“Too many plugins slow

    down your site!” •Quality vs. Quantity •Modules (one plugin or many) •Should always have one custom “functionality” plugin
  6. Caching •More than just a plugin •Use transients to cache

    slow/large queries •Debug Bar/Query Monitor/Slow Queries
  7. Giving clients too much control •Editor or “Super Editor” role

    •Admin Restriction plugin •Adminimize •Sell them a maintenance service, or refer them
  8. Avoiding Fragility •Prefix or encapsulate code in an object •Escape

    or sanitize all output •Turn off plugins and make sure nothing explodes
  9. Shortcode soup = #FAIL [wrapper] [column][item image=”…” url=”…”}[/column][column][item image=”..” url=”…”][/column]

    [column][item image=”…” url=”…”}[/column][column][item image=”..” url=”…”][/column] [column][item image=”…” url=”…”}[/column][column][item image=”..” url=”…”][/column] [column][item image=”…” url=”…”}[/column][column][item image=”..” url=”…”][/column] [column][item image=”…” url=”…”}[/column] [column][item image=”..” url=”…”][/column] [column][item image=”…” url=”…”}[/column][column][item image=”..” url=”…”][/column] [column][item image=”…” url=”…”}[/column][column][item image=”..” url=”…”][/column] [column][item image=”…” url=”…”}[/column][column][item image=”..” url=”…”][/column] [column][item image=”…” url=”…”}[/column][column][item image=”..” url=”…”][/column] [/wrapper]