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.
Philip Arthur Moore: Best Practices — On Breaking and Fixing WordPress Themes
1. Best Practices
On Making, Breaking, and Fixing WordPress Themes
Philip Arthur Moore / Theme Wrangler at Automattic Inc.
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. 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. Important Plugins for Theme Development
Debug Bar: Adds a debug menu to the toolbar that shows query, cache, and other
helpful debugging information.
Debug Bar Console: Adds a PHP/MySQL console to the debug bar.
Log Deprecated Notices: Logs the usage of deprecated files, functions, and
function arguments, offers the alternative if available, and identifies where the
deprecated functionality is being used.
Regenerate Thumbnails: Allows you to regenerate all thumbnails after changing
the 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.
18. Your Theme Should Respond Well To:
Long Site Titles: e.g. The point of using Lorem Ipsum is
that it has a more-or-less normal distribution of letters, as
opposed to using 'Content here, content here', making it
look like readable English.
Long Site Descriptions: e.g. Lorem Ipsum is simply dummy
text of the printing and typesetting industry. Lorem Ipsum
has been the industry's standard dummy text ever since the
1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book. It has survived
not only five centuries, but also the leap into electronic
typesetting, remaining essentially unchanged. It was
popularised in the 1960s with the release of Letraset sheets
containing Lorem Ipsum passages, and more recently with
desktop publishing software like Aldus PageMaker including
versions of Lorem Ipsum.
19. Your Theme Should Respond Well To:
Index and Archive Pagination i.e. paged=2 or page/2
Threaded and Paginated Comments
Super Large Images $content_width check
Non-Default Permalinks i.e. /%year%/%monthnum%/%day%/
%postname%/
Super-Short and Super-Long Menus custom and non-custom
Custom Front Page and Posts Page i.e. site.com/blog/
Non-Titled Posts and Non-Content Posts
Password-Protected Content
Widgets i.e. 0, 1, or 20 widgets