SlideShare une entreprise Scribd logo
1  sur  26
Best Practices
On 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 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
 */
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
 */
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.
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 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.
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
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-links' );

// This theme uses Featured Images (also known as post thumbnails) for per-
post/per-page Custom Header images
add_theme_support( 'post-thumbnails' );

// Add support for a variety of post formats
add_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();
i18n
// i18n
load_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
 */
http://codex.wordpress.org/Theme_Review
Thanks

Contenu connexe

Tendances

Installation of wordpress
Installation of wordpressInstallation of wordpress
Installation of wordpress
HAINIRMALRAJ
 
Getting started-with-zend-framework
Getting started-with-zend-frameworkGetting started-with-zend-framework
Getting started-with-zend-framework
Marcelo da Rocha
 
Selenium 2: The Future of Selenium is now!
Selenium 2: The Future of Selenium is now!Selenium 2: The Future of Selenium is now!
Selenium 2: The Future of Selenium is now!
AutomatedTester
 
Apex code-fundamentals
Apex code-fundamentalsApex code-fundamentals
Apex code-fundamentals
Amit Sharma
 

Tendances (20)

Magento Meetup New Delhi- Console
Magento Meetup New Delhi- ConsoleMagento Meetup New Delhi- Console
Magento Meetup New Delhi- Console
 
Installation of wordpress
Installation of wordpressInstallation of wordpress
Installation of wordpress
 
Getting started-with-zend-framework
Getting started-with-zend-frameworkGetting started-with-zend-framework
Getting started-with-zend-framework
 
Aloha Editor usage example
Aloha Editor usage exampleAloha Editor usage example
Aloha Editor usage example
 
Weblogic.deployer usage
Weblogic.deployer usageWeblogic.deployer usage
Weblogic.deployer usage
 
Akka sample using typesafe activator
Akka sample using typesafe activatorAkka sample using typesafe activator
Akka sample using typesafe activator
 
Troubleshooting mule
Troubleshooting muleTroubleshooting mule
Troubleshooting mule
 
Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with Selenium
 
Web Application Development using MVC Framework Kohana
Web Application Development using MVC Framework KohanaWeb Application Development using MVC Framework Kohana
Web Application Development using MVC Framework Kohana
 
Php
PhpPhp
Php
 
Deploying and Running in Mule
Deploying and Running in MuleDeploying and Running in Mule
Deploying and Running in Mule
 
Wordpress multisite
Wordpress multisiteWordpress multisite
Wordpress multisite
 
Automated testing with Drupal
Automated testing with DrupalAutomated testing with Drupal
Automated testing with Drupal
 
Getting anypoint studios all versions
Getting anypoint studios all versionsGetting anypoint studios all versions
Getting anypoint studios all versions
 
Selenium 2: The Future of Selenium is now!
Selenium 2: The Future of Selenium is now!Selenium 2: The Future of Selenium is now!
Selenium 2: The Future of Selenium is now!
 
Installation of Joomla on Windows XP
Installation of Joomla on Windows XPInstallation of Joomla on Windows XP
Installation of Joomla on Windows XP
 
Apex code-fundamentals
Apex code-fundamentalsApex code-fundamentals
Apex code-fundamentals
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
 
Integration with CMIS using Mule ESB
Integration with CMIS using Mule ESBIntegration with CMIS using Mule ESB
Integration with CMIS using Mule ESB
 
Magento 2 Theme Trainning for Beginners | Magenest
Magento 2 Theme Trainning for Beginners | MagenestMagento 2 Theme Trainning for Beginners | Magenest
Magento 2 Theme Trainning for Beginners | Magenest
 

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

WordPress Ann Arbor: WP Tips and Tricks
WordPress Ann Arbor: WP Tips and TricksWordPress Ann Arbor: WP Tips and Tricks
WordPress Ann Arbor: WP Tips and Tricks
oneilldec
 
Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To Drupal
Lauren Roth
 
WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1
Yoav Farhi
 
Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
sasidhar
 
Step by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginStep by step guide for creating wordpress plugin
Step by step guide for creating wordpress plugin
Mainak Goswami
 

Similaire à Philip Arthur Moore: Best Practices — On Breaking and Fixing WordPress Themes (20)

WordPress Theming 101
WordPress Theming 101WordPress Theming 101
WordPress Theming 101
 
WordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media InstituteWordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media Institute
 
WordPress Ann Arbor: WP Tips and Tricks
WordPress Ann Arbor: WP Tips and TricksWordPress Ann Arbor: WP Tips and Tricks
WordPress Ann Arbor: WP Tips and Tricks
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
 
Beginner's guide to drupal
Beginner's guide to drupalBeginner's guide to drupal
Beginner's guide to drupal
 
W pthemes
W pthemesW pthemes
W pthemes
 
Writing your own WordPress themes and plugins
Writing your own WordPress themes and pluginsWriting your own WordPress themes and plugins
Writing your own WordPress themes and plugins
 
Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To Drupal
 
Getting Started With WordPress Development
Getting Started With WordPress DevelopmentGetting Started With WordPress Development
Getting Started With WordPress Development
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
 
WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1
 
Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
 
WordPress 3.0 at DC PHP
WordPress 3.0 at DC PHPWordPress 3.0 at DC PHP
WordPress 3.0 at DC PHP
 
CMS 101 Drupal
CMS 101 DrupalCMS 101 Drupal
CMS 101 Drupal
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
 
Step by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginStep by step guide for creating wordpress plugin
Step by step guide for creating wordpress plugin
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
 
Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011
 
Connections customization lite
Connections customization liteConnections customization lite
Connections customization lite
 
WordPress Plugin Development- Rich Media Institute Workshop
WordPress Plugin Development- Rich Media Institute WorkshopWordPress Plugin Development- Rich Media Institute Workshop
WordPress Plugin Development- Rich Media Institute Workshop
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

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.
  • 5. Debug Bar Provides Useful Query Information
  • 6. Debug Bar Reports PHP Notices and Warnings
  • 12. Reveal IDs for Admin
  • 13. RTL Tester Quickly Checks rtl.css
  • 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
  • 21. Test For Built-In WordPress Functionality
  • 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 images add_theme_support( 'post-thumbnails' ); // Add support for a variety of post formats add_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. i18n
  • 24. // i18n load_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 */

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n