Best PracticesOn Making, Breaking, and Fixing WordPress Themes    Philip Arthur Moore / Theme Wrangler at Automattic Inc.
WP_DEBUG/** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during de...
SCRIPT_DEBUG/** * For developers: Load development versions of all scripts. * * Change this to true to load all non-minifi...
Important Plugins for Theme DevelopmentDebug Bar: Adds a debug menu to the toolbar that shows query, cache, and otherhelpf...
Debug Bar Provides Useful Query Information
Debug Bar Reports PHP Notices and Warnings
Debug Bar Console
Log Deprecated Notices
Regenerate Thumbnails
Regenerate Thumbnails
Regenerate Thumbnails
Reveal IDs for Admin
RTL Tester Quickly Checks rtl.css
RTL Tester Activated
Theme-Check
Theme-Check Finds Theme Errors
Unit Testing is Vital
Your Theme Should Respond Well To:Long Site Titles: e.g. The point of using Lorem Ipsum isthat it has a more-or-less norma...
Your Theme Should Respond Well To:Index and Archive Pagination i.e. paged=2 or page/2Threaded and Paginated CommentsSuper ...
http://codex.wordpress.org/Theme_Unit_Test
Test For Built-In WordPress Functionality
add_theme_support( $feature );// Add default posts and comments RSS feed links to <head>.add_theme_support( automatic-feed...
i18n
// i18nload_theme_textdomain( autofocus, get_template_directory_uri() . /languages );$locale = get_locale();$locale_file =...
http://codex.wordpress.org/Theme_Review
Thanks
Upcoming SlideShare
Loading in...5
×

Philip Arthur Moore: Best Practices — On Breaking and Fixing WordPress Themes

4,001

Published on

These slides accompany a presentation given at WordCamp Singapore 2011 ( http://2011.singapore.wordcamp.org/ ) on the breaking of fixing of WordPress themes. Important plugins to aid in theme testing are discussed, as well as vital unit tests to perform before the public release of a WordPress theme.

Published in: Technology, Business
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,001
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
36
Comments
0
Likes
5
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
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Philip Arthur Moore: Best Practices — On Breaking and Fixing WordPress Themes

    1. 1. Best PracticesOn Making, Breaking, and Fixing WordPress Themes Philip Arthur Moore / Theme Wrangler at Automattic Inc.
    2. 2. WP_DEBUG/** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. */define( WP_DEBUG, true );/** * For developers: Logging WordPress errors. * * PHP errors and notices will be logged to the file /wp-content/debug.log */define( WP_DEBUG_LOG, true );define( WP_DEBUG_DISPLAY, false );/** * Find more default constants in /wp-includes/default-constants.php * Link: http://codex.wordpress.org/Editing_wp-config.php */
    3. 3. SCRIPT_DEBUG/** * For developers: Load development versions of all scripts. * * Change this to true to load all non-minified scripts and CSS. When * SCRIPT_DEBUG is set to true compression and concatenation are disabled. */define( SCRIPT_DEBUG, true );/** * Find more script-related constants in /wp-includes/script-loader.php * Link: http://codex.wordpress.org/Editing_wp-config.php */
    4. 4. Important Plugins for Theme DevelopmentDebug Bar: Adds a debug menu to the toolbar that shows query, cache, and otherhelpful debugging information.Debug Bar Console: Adds a PHP/MySQL console to the debug bar.Log Deprecated Notices: Logs the usage of deprecated files, functions, andfunction arguments, offers the alternative if available, and identifies where thedeprecated functionality is being used.Regenerate Thumbnails: Allows you to regenerate all thumbnails after changingthe thumbnail sizes.Reveal IDs: Show post, page, category, tag, and link IDs in the Dashboard.RTL Tester: Allows quick rtl.css testing by adding a switch to the toolbar.Theme-Check: Tests a WordPress theme against the latest WP standards.WordPress Importer: Bulk content migration from site to site.
    5. 5. Debug Bar Provides Useful Query Information
    6. 6. Debug Bar Reports PHP Notices and Warnings
    7. 7. Debug Bar Console
    8. 8. Log Deprecated Notices
    9. 9. Regenerate Thumbnails
    10. 10. Regenerate Thumbnails
    11. 11. Regenerate Thumbnails
    12. 12. Reveal IDs for Admin
    13. 13. RTL Tester Quickly Checks rtl.css
    14. 14. RTL Tester Activated
    15. 15. Theme-Check
    16. 16. Theme-Check Finds Theme Errors
    17. 17. Unit Testing is Vital
    18. 18. Your Theme Should Respond Well To:Long Site Titles: e.g. The point of using Lorem Ipsum isthat it has a more-or-less normal distribution of letters, asopposed to using Content here, content here, making itlook like readable English.Long Site Descriptions: e.g. Lorem Ipsum is simply dummytext of the printing and typesetting industry. Lorem Ipsumhas been the industrys standard dummy text ever since the1500s, when an unknown printer took a galley of type andscrambled it to make a type specimen book. It has survivednot only five centuries, but also the leap into electronictypesetting, remaining essentially unchanged. It waspopularised in the 1960s with the release of Letraset sheetscontaining Lorem Ipsum passages, and more recently withdesktop publishing software like Aldus PageMaker includingversions of Lorem Ipsum.
    19. 19. Your Theme Should Respond Well To:Index and Archive Pagination i.e. paged=2 or page/2Threaded and Paginated CommentsSuper Large Images $content_width checkNon-Default Permalinks i.e. /%year%/%monthnum%/%day%/%postname%/Super-Short and Super-Long Menus custom and non-customCustom Front Page and Posts Page i.e. site.com/blog/Non-Titled Posts and Non-Content PostsPassword-Protected ContentWidgets i.e. 0, 1, or 20 widgets
    20. 20. http://codex.wordpress.org/Theme_Unit_Test
    21. 21. Test For Built-In WordPress Functionality
    22. 22. add_theme_support( $feature );// Add default posts and comments RSS feed links to <head>.add_theme_support( automatic-feed-links );// This theme uses Featured Images (also known as post thumbnails) for per-post/per-page Custom Header imagesadd_theme_support( post-thumbnails );// Add support for a variety of post formatsadd_theme_support( post-formats, array( aside, link, gallery,status, quote, image ) );/** * Link: http://codex.wordpress.org/Function_Reference/add_theme_support */ add_editor_style(); add_custom_background(); register_nav_menu(); add_custom_image_header();
    23. 23. i18n
    24. 24. // i18nload_theme_textdomain( autofocus, get_template_directory_uri() . /languages );$locale = get_locale();$locale_file = get_template_directory_uri() . "/languages/$locale.php";if ( is_readable( $locale_file ) ) require_once( $locale_file );/** * Link: http://codex.wordpress.org/I18n_for_WordPress_Developers */
    25. 25. http://codex.wordpress.org/Theme_Review
    26. 26. Thanks
    1. A particular slide catching your eye?

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

    ×