Creating usable,
maintainable, and
upgradable
WordPress sites
Slide 3
Slide 3 text
Keeping functions.php
lean and mean
Slide 4
Slide 4 text
My concerns about "separation
of concerns" in WordPress
development
Slide 5
Slide 5 text
Common WordPress Coding
#FAILs You Should Avoid
Slide 6
Slide 6 text
“Don’t be someone else’s
rescue project”
Slide 7
Slide 7 text
You’re doing_it_wrong();
Slide 8
Slide 8 text
No content
Slide 9
Slide 9 text
No content
Slide 10
Slide 10 text
No content
Slide 11
Slide 11 text
Hacking Core Files
•But I found a bug!
•Are you sure?
•Check Trac!
Slide 12
Slide 12 text
No content
Slide 13
Slide 13 text
No content
Slide 14
Slide 14 text
No content
Slide 15
Slide 15 text
Hacking plugin files
•Fork it (preferably on GitHub)
•Hack the version number or disable auto updates
•Document your hack!
Slide 16
Slide 16 text
Child Themes
Slide 17
Slide 17 text
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)
Slide 18
Slide 18 text
Avoiding Bloat
Slide 19
Slide 19 text
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
Slide 20
Slide 20 text
ThemeForest?
Slide 21
Slide 21 text
ThemeSwamp?
Slide 22
Slide 22 text
No content
Slide 23
Slide 23 text
No content
Slide 24
Slide 24 text
Enqueue all the Things?
•Only enqueue it when you need it
•You can enqueue scripts and styles in shortcodes
•has_shortcode() (WP 3.9+)
Slide 25
Slide 25 text
Image Insanity
•TimThumb ➤ WP-Thumb
Slide 26
Slide 26 text
Image Insanity
Slide 27
Slide 27 text
Image Insanity
Slide 28
Slide 28 text
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
Slide 29
Slide 29 text
No content
Slide 30
Slide 30 text
Caching
•More than just a plugin
•Use transients to cache slow/large queries
•Debug Bar/Query Monitor/Slow Queries
Slide 31
Slide 31 text
Caching
Slide 32
Slide 32 text
No content
Slide 33
Slide 33 text
No content
Slide 34
Slide 34 text
Giving clients too much control
•Editor or “Super Editor” role
•Admin Restriction plugin
•Adminimize
•Sell them a maintenance service, or refer them
Slide 35
Slide 35 text
Cowboy Coding
Slide 36
Slide 36 text
Cowboy Coding
•define( 'DISALLOW_FILE_EDIT', true );
•Git + Bitbucket
•ServerPress (or MAMP, VVV, etc).
•WP Migrate DB Pro
Slide 37
Slide 37 text
No content
Slide 38
Slide 38 text
No content
Slide 39
Slide 39 text
No content
Slide 40
Slide 40 text
No content
Slide 41
Slide 41 text
Avoiding Fragility
•Prefix or encapsulate code in an object
•Escape or sanitize all output
•Turn off plugins and make sure nothing explodes