Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

7 Tips on Getting Your Theme Approved the First Time

1,371 views

Published on

Tips on getting your theme approved in a WordPress.org theme repository.

Published in: Software
  • Be the first to comment

  • Be the first to like this

7 Tips on Getting Your Theme Approved the First Time

  1. 1. 7 Tips on Getting Your Theme Approved The First Time Dmitry Mayorov / www.themepatio.com WordCamp London 2016
  2. 2. Why Release Your Theme Publicly?
  3. 3. Why Release Your Theme Publicly -- Give back to the community -- Get real feedback -- Become a better designer/developer
  4. 4. 1. GPL License
  5. 5. With GPL Users are Free to : -- Use the theme for any purpose -- Study the source code -- Modify the theme -- Redistribute the theme
  6. 6. How To Make Sure Your Theme is GPL-friendly?
  7. 7. /* Theme Name: Maker Author: ThemePatio Text Domain: maker License: GNU GPL v2 or later License URI: http://www.gnu.org/licenses/gpl-2 Declare the License in style.css
  8. 8. === Maker === Contributors: iamdmitrymayorov Version: 0.2.0 License: GNU GPL v2 or later License URI: http://www.gnu.org/licenses/gpl- Tags: black, gray, red, white, dark, l Declare the License in readme.txt
  9. 9. Typicons Author: Stephen Hutchings License: SIL (http://scripts.sil.org/OFL) URL: http://typicons.com/ Bundle Only GPL-friendly Resources
  10. 10. Chair & Table Author: Jordan Sanchez Licence: CC0 1.0 URL: https://unsplash.com/photos/KyB-Eo4xS Use Only GPL-friendly Images
  11. 11. Check License Compatibility www.gnu.org/licenses/license-list.en.html #GPLCompatibleLicenses
  12. 12. GPL Summary -- Declare the license in style.css and readme.txt -- Bundle only GPL-friendly code -- Use only GPL-friendly images -- Provide info in the readme.txt
  13. 13. 2. Don’t Start From Scratch
  14. 14. Underscores (_s) components.underscores.me
  15. 15. Components components.underscores.me
  16. 16. 3. Requirements
  17. 17. <head> ... <script src=’theme.js’></script> ... </head> 3.1 Don’t Hardcode Scripts and Styles
  18. 18. wp_enqueue_script( ‘maker-custom’, get_template_directory_uri() .‘theme.js’, ); functions.php
  19. 19. wp_enqueue_script( ‘jquery’ ); functions.php
  20. 20. Full List of Bundled Resources developer.wordpress.org/reference/functions/ wp_enqueue_script/
  21. 21. 3.2 Prefix Everything -- Functions -- Classes -- Actions and filters -- Global variables -- Database entries
  22. 22. function output() { // Code goes here. } Bad Example
  23. 23. function maker_entry_meta() { // Code goes here. } Good Example
  24. 24. 3.3 Validate & Sanitize
  25. 25. sanitize_text_field( $input ) Sanitize On The Input
  26. 26. $wp_customize->add_setting( ‘footer’, array( ‘sanitize_callback’ => ‘sanitize_text_field’, ) ); Sanitize On The Input
  27. 27. esc_html( $output ); Escape On The Output
  28. 28. // Get the data. $prefix_name = get_theme_mod( ‘footer’ ); // Escape as a late as possible and display. echo esc_html( $prefix_name ); Escape On The Output
  29. 29. More Detailed Explanation codex.wordpress.org/Data_Validation
  30. 30. 3.4 Translatable Strings
  31. 31. echo ‘Comments’; Theme For a Client
  32. 32. echo __( ‘Comments’, ‘themeslug’ ); Public Theme
  33. 33. _e( ‘Comments’, ‘themeslug’ ); Public Theme
  34. 34. esc_html_e( ‘Comments’, ‘themeslug’ ); Public Theme
  35. 35. More Info On I18N codex.wordpress.org/I18n_for_WordPress_Developers
  36. 36. 3.5 Theme vs. Plugin Territory
  37. 37. More Info on Requirements make.wordpress.org/themes/handbook/ review/required
  38. 38. 4. Learn From Others
  39. 39. 4.1. Study Default Themes
  40. 40. 4.2 Study Other Themes From the Repository
  41. 41. 5. Test
  42. 42. define( ‘WP_DEBUG’, true ); 5.1 wp-config.php
  43. 43. 5.2 Theme Check Plugin wordpress.org/plugins/theme-check
  44. 44. 5.3 Codesniffer with WPCS github.com/WordPress-Coding-Standards/ WordPress-Coding-Standards
  45. 45. 5.4 Theme Unit Test codex.wordpress.org/Theme_Unit_Test
  46. 46. 5.5 Monster Widget Plugin wordpress.org/plugins/theme-check
  47. 47. 5.6 Real Content
  48. 48. 6. Become a Reviewer
  49. 49. 7. Keep It Simple
  50. 50. Questions? Dmitry Mayorov / www.themepatio.com WordCamp London 2016

×