0
DOING_IT_RIGHT() WITH    WORDPRESS            Ryan Duff      Fusionized Technology
WHO AM I• Using WordPress   since 2004 (version 1.2)• WordPress   Professional for hire
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’...
FIRST THINGS FIRST• Use   the debug bar plugin define(‘WP_DEBUG’, true); define(‘WP_DEBUG_DISPLAY, false); define(‘SAVEQUERIE...
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 HTTP requests for WordPress. Handles coo...
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•   Dashboard widgets    •   Plugin•   Database             •   Rewrite•   HTTP                 •   Settings...
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 freenode
QUESTIONS?       Ryan DuffFusionized Technology http://fusionized.com      @ryancduff
Upcoming SlideShare
Loading in...5
×

doing_it_right() with WordPress

322

Published on

WordPress development best practices. Presented at CPOSC 2012 10/27/2012

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

  • Be the first to like this

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

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript of "doing_it_right() with WordPress"

    1. 1. DOING_IT_RIGHT() WITH WORDPRESS Ryan Duff Fusionized Technology
    2. 2. WHO AM I• Using WordPress since 2004 (version 1.2)• WordPress Professional for hire
    3. 3. WHY DO IT RIGHT• Save yourself time• Save others time• Save your clients money• Save everybody from headaches
    4. 4. 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
    5. 5. FIRST THINGS FIRST• Use the debug bar plugin define(‘WP_DEBUG’, true); define(‘WP_DEBUG_DISPLAY, false); define(‘SAVEQUERIES’, true);
    6. 6. ORGANIZE YOUR CODE• What goes in a plugin?• What goes in a theme?• Utilize mu-plugins/
    7. 7. ORGANIZE YOUR CODEhttp://codex.wordpress.org/Template_Hierarchy
    8. 8. DOCUMENT YOUR CODE/** * Simple and uniform HTTP request API. * * Standardizes the HTTP requests for WordPress. Handles cookies, gzipencoding and decoding, chunk * decoding, if HTTP 1.1 and various other difficult HTTP protocolimplementations. * * @link http://trac.wordpress.org/ticket/4779 HTTP API Proposal * * @package WordPress * @subpackage HTTP * @since 2.7.0 */
    9. 9. OPTIMIZE YOUR CODE• Cache• Get rid of rotten database queries
    10. 10. OPTIMIZE YOUR CODEset_transient( $transient, $value, $expiration );get_transient( $transient );delete_transient( $transient );
    11. 11. 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
    12. 12. DON’T REINVENT THE WHEEL• Clever code is not clever.• Use built in APIs and methods
    13. 13. WORDPRESS APIS• Dashboard widgets • Plugin• Database • Rewrite• HTTP • Settings• File Header • Shortcode• Filesystem • Theme modification• Metadata • Transients• Options • Widgets
    14. 14. ACTION HOOKS AND FILTERS• Hooks are places to DO things• Filters are ways to CHANGE things
    15. 15. MORE THINGS NOT TO DO• Don’t downgrade jQuery• Don’t create unnecessary settings• Don’t forget to update
    16. 16. SECURE CODE• esc_html()• esc_attr()• esc_url()• $wpdb->prepare() http://codex.wordpress.org/Data_Validation
    17. 17. HOW TO LEARN MORE• Read the code and contribute http://core.trac.wordpress.org• Ask questions in #wordpress on freenode
    18. 18. 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.

    ×