7 tips on getting your theme approved the first time
TRANSCRIPT
![Page 1: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/1.jpg)
7 Tips on Getting Your Theme Approved The First Time
Dmitry Mayorov / www.themepatio.com
WordCamp London 2016
![Page 2: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/2.jpg)
![Page 3: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/3.jpg)
![Page 4: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/4.jpg)
Why Release Your Theme Publicly?
![Page 5: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/5.jpg)
Why Release Your Theme Publicly
- Give back to the community
- Get real feedback
- Become a better designer/developer
![Page 6: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/6.jpg)
1. GPL License
![Page 7: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/7.jpg)
With GPL Users are Free to :
- Use the theme for any purpose
- Study the source code
- Modify the theme
- Redistribute the theme
![Page 8: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/8.jpg)
How To Make Sure Your Theme is GPL-friendly?
![Page 9: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/9.jpg)
/*Theme Name: MakerAuthor: ThemePatioText Domain: makerLicense: GNU GPL v2 or laterLicense URI: http://www.gnu.org/licenses/gpl-2.0.html
Declare the License in style.css
![Page 10: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/10.jpg)
=== Maker ===Contributors: iamdmitrymayorovVersion: 0.2.0License: GNU GPL v2 or laterLicense URI: http://www.gnu.org/licenses/gpl-2.0.htmlTags: black, gray, red, white, dark, light,
Declare the License in readme.txt
![Page 11: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/11.jpg)
TypiconsAuthor: Stephen HutchingsLicense: SIL (http://scripts.sil.org/OFL)URL: http://typicons.com/
Bundle Only GPL-friendly Resources
![Page 12: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/12.jpg)
Chair & TableAuthor: Jordan SanchezLicence: CC0 1.0URL: https://unsplash.com/photos/KyB-Eo4xS_c
Use Only GPL-friendly Images
![Page 13: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/13.jpg)
Check License Compatibilitywww.gnu.org/licenses/license-list.en.html
#GPLCompatibleLicenses
![Page 14: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/14.jpg)
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
![Page 15: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/15.jpg)
2. Don’t Start From Scratch
![Page 16: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/16.jpg)
Underscores (_s)components.underscores.me
![Page 17: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/17.jpg)
Componentscomponents.underscores.me
![Page 18: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/18.jpg)
3. Requirements
![Page 19: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/19.jpg)
<head>...<script src=’theme.js’></script>...</head>
3.1 Don’t Hardcode Scripts and Styles
![Page 20: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/20.jpg)
wp_enqueue_script( ‘maker-custom’, get_template_directory_uri() .‘theme.js’,);
functions.php
![Page 21: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/21.jpg)
wp_enqueue_script( ‘jquery’ );
functions.php
![Page 22: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/22.jpg)
Full List of Bundled Resourcesdeveloper.wordpress.org/reference/functions/
wp_enqueue_script/
![Page 23: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/23.jpg)
3.2 Prefix Everything
- Functions
- Classes
- Actions and filters
- Global variables
- Database entries
![Page 24: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/24.jpg)
function output() { // Code goes here.}
Bad Example
![Page 25: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/25.jpg)
![Page 26: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/26.jpg)
function maker_entry_meta() { // Code goes here.}
Good Example
![Page 27: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/27.jpg)
3.3 Validate & Sanitize
![Page 28: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/28.jpg)
![Page 29: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/29.jpg)
![Page 30: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/30.jpg)
sanitize_text_field( $input )
Sanitize On The Input
![Page 31: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/31.jpg)
$wp_customize->add_setting( ‘footer’, array( ‘sanitize_callback’ => ‘sanitize_text_field’,) );
Sanitize On The Input
![Page 32: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/32.jpg)
esc_html( $output );
Escape On The Output
![Page 33: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/33.jpg)
// 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
![Page 34: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/34.jpg)
More Detailed Explanationcodex.wordpress.org/Data_Validation
![Page 35: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/35.jpg)
3.4 Translatable Strings
![Page 36: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/36.jpg)
echo ‘Comments’;
Theme For a Client
![Page 37: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/37.jpg)
echo __( ‘Comments’, ‘themeslug’ );
Public Theme
![Page 38: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/38.jpg)
_e( ‘Comments’, ‘themeslug’ );
Public Theme
![Page 39: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/39.jpg)
esc_html_e( ‘Comments’, ‘themeslug’ );
Public Theme
![Page 40: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/40.jpg)
More Info On I18Ncodex.wordpress.org/I18n_for_WordPress_Developers
![Page 41: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/41.jpg)
3.5 Theme vs. Plugin Territory
![Page 42: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/42.jpg)
More Info on Requirementsmake.wordpress.org/themes/handbook/
review/required
![Page 43: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/43.jpg)
4. Learn From Others
![Page 44: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/44.jpg)
4.1. Study Default Themes
![Page 45: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/45.jpg)
4.2 Study Other Themes From the Repository
![Page 46: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/46.jpg)
5. Test
![Page 47: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/47.jpg)
define( ‘WP_DEBUG’, true );
5.1 wp-config.php
![Page 48: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/48.jpg)
5.2 Theme Check Pluginwordpress.org/plugins/theme-check
![Page 49: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/49.jpg)
![Page 50: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/50.jpg)
5.3 Codesniffer with WPCSgithub.com/WordPress-Coding-Standards/
WordPress-Coding-Standards
![Page 51: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/51.jpg)
5.4 Theme Unit Testcodex.wordpress.org/Theme_Unit_Test
![Page 52: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/52.jpg)
5.5 Monster Widget Pluginwordpress.org/plugins/theme-check
![Page 53: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/53.jpg)
5.6 Real Content
![Page 54: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/54.jpg)
6. Become a Reviewer
![Page 55: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/55.jpg)
7. Keep It Simple
![Page 56: 7 Tips on Getting Your Theme Approved the First Time](https://reader034.vdocuments.mx/reader034/viewer/2022042723/587697251a28abab2f8b705f/html5/thumbnails/56.jpg)
Questions?Dmitry Mayorov / www.themepatio.com
WordCamp London 2016