doing_it_right() with    Wordpress              Ryan Duff    Harrisburg WordPress Meetup         February 19th, 2013
Why do it right•   Save yourself time•   Save others time•   Save your clients money•   Save everybody from headaches
Ways to do it right•   Learn to organize your code          • ... document   your code•   ... optimize your code•   Don’t ...
First things first•   Use the debug bar plugin    define(‘WP_DEBUG’, true);    define(‘WP_DEBUG_DISPLAY, false);    define...
Organize your code•   What goes in a plugin?•   What goes in a theme?•   Utilize mu-plugins/
Organize your codehttp://codex.wordpress.org/Template_Hierarchy
Document your code/** * Simple and uniform HTTP request API. * * Standardizes the HTTPrequests for WordPress. Handles cook...
Optimize your code•   Cache•   Get rid of rotten database queries
Optimize your codeset_transient( $transient, $value, $expiration );get_transient( $transient );delete_transient( $transien...
Optimize your code•   Make sure the code you’re expecting matches•   Use $wpdb class in the correct cases, WP_Query otherw...
Don’t reinvent the wheel•   Clever code is not clever.•   Use built in APIs and methods
WordPress APIs
Action hooks and filters•   Hooks are places to DO things•   Filters are ways to CHANGE things
More things not to do•   Don’t downgrade jQuery•   Don’t create unnecessary settings•   Don’t forget to update
Secure code•   esc_html()•   esc_attr()•   esc_url()•   $wpdb->prepare()         http://codex.wordpress.org/Data_Validation
How to learn more•   Read the code and contribute    http://core.trac.wordpress.org•   Ask questions in #wordpress on free...
Questions?       Ryan DuffFusionized Technology http://fusionized.com      @ryancduff
Upcoming SlideShare
Loading in...5
×

WordPress Harrisburg Meetup - Best Practices

269

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
269
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

WordPress Harrisburg Meetup - Best Practices

  1. 1. doing_it_right() with Wordpress Ryan Duff Harrisburg WordPress Meetup February 19th, 2013
  2. 2. Why do it right• Save yourself time• Save others time• Save your clients money• Save everybody from headaches
  3. 3. Ways to do it right• Learn to organize your code • ... document your code• ... optimize your code• Don’t reinvent the wheel• Action Hooks and Filters• Other very bad things to avoid
  4. 4. First things first• Use the debug bar plugin define(‘WP_DEBUG’, true); define(‘WP_DEBUG_DISPLAY, false); define(‘SAVEQUERIES’, true);
  5. 5. Organize your code• What goes in a plugin?• What goes in a theme?• Utilize mu-plugins/
  6. 6. Organize your codehttp://codex.wordpress.org/Template_Hierarchy
  7. 7. Document your code/** * Simple and uniform HTTP request API. * * Standardizes the HTTPrequests for WordPress. Handles cookies, gzip encoding and decoding,chunk * decoding, if HTTP 1.1 and various other difficult HTTP protocolimplementations. * * @link http://trac.wordpress.org/ticket/4779 HTTPAPI Proposal * * @package WordPress * @subpackage HTTP * @since2.7.0 */
  8. 8. Optimize your code• Cache• Get rid of rotten database queries
  9. 9. Optimize your codeset_transient( $transient, $value, $expiration );get_transient( $transient );delete_transient( $transient );
  10. 10. Optimize your code• Make sure the code you’re expecting matches• Use $wpdb class in the correct cases, WP_Query otherwise• Sanitize everything http://codex.wordpress.org/Data_Validation
  11. 11. Don’t reinvent the wheel• Clever code is not clever.• Use built in APIs and methods
  12. 12. WordPress APIs
  13. 13. Action hooks and filters• Hooks are places to DO things• Filters are ways to CHANGE things
  14. 14. More things not to do• Don’t downgrade jQuery• Don’t create unnecessary settings• Don’t forget to update
  15. 15. Secure code• esc_html()• esc_attr()• esc_url()• $wpdb->prepare() http://codex.wordpress.org/Data_Validation
  16. 16. How to learn more• Read the code and contribute http://core.trac.wordpress.org• Ask questions in #wordpress on freenode
  17. 17. Questions? Ryan DuffFusionized Technology http://fusionized.com @ryancduff
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×