Think Before You Submit Themes on WordPress dot Org

59

Transcript of Think Before You Submit Themes on WordPress dot Org

Page 1: Think Before You Submit Themes on WordPress dot Org
Page 2: Think Before You Submit Themes on WordPress dot Org

HELLO!

Ganga Kafle

Co-Founder / Partner of Acme Themes

Co-Owner of Template Sell

Page 3: Think Before You Submit Themes on WordPress dot Org

Think Before You Submit Themes on WordPress.Org

Page 4: Think Before You Submit Themes on WordPress dot Org

Should my theme be based on standards?

Page 5: Think Before You Submit Themes on WordPress dot Org

1.Setup Theme Development Environment

Page 6: Think Before You Submit Themes on WordPress dot Org

Before beginning to theme development, do the following things:

1. define('WP_DEBUG', true); in wp-config.php file2. Import theme unit test data (https://wpcom-

themes.svn.automattic.com/demo/theme-unit-test-data.xml )

3. Install and activate Developer Plugin4. Check your theme with Theme Check and Theme

Sniffer Plugin

Page 7: Think Before You Submit Themes on WordPress dot Org
Page 8: Think Before You Submit Themes on WordPress dot Org

2.What are the Theme Standards? What your theme should have?

Page 9: Think Before You Submit Themes on WordPress dot Org

Your theme must have the following things

1. GPL compatible.2. Secure.3. Free of PHP or JS notices, warnings and

errors.4. Should not be in conflict with plugins e.g.

prefixing.5. Translation ready.6. Use WordPress functions, hooks, filters and

libraries.7. Away from anything illegal, dishonest, or

morally offensive.

Page 10: Think Before You Submit Themes on WordPress dot Org

3.style.css Components

Page 11: Think Before You Submit Themes on WordPress dot Org

Check the below given things on your theme style.css file.

/*Theme Name: Japan Tokyo Theme URI: Recommended Author: RequiredAuthor URI: Recommended Description: Required Version: 1.0.0 ( Required ) License: GNU General Public License v2 or laterLicense URI: http://www.gnu.org/licenses/gpl-2.0.htmlText Domain: japan-tokyo ( Required )Tags: Required */

Page 12: Think Before You Submit Themes on WordPress dot Org

4.The GPL License

Page 13: Think Before You Submit Themes on WordPress dot Org

GPL (General Public License)

1. Declare License of any external resources used

2. Only resources bundled with the theme need to be declared.

3. Ensure your theme is GPL licensed or GPL Compatible

4. Mentioned on style.css5. Include copyright notice for the theme

Page 14: Think Before You Submit Themes on WordPress dot Org
Page 15: Think Before You Submit Themes on WordPress dot Org

Mention License of external resources (if used any)

1. Google Font License

2. Font awesome license

3. External JS and CSS license

4. External Library license

5. Screenshot image/images

Page 16: Think Before You Submit Themes on WordPress dot Org

License declared on readme.txt file

Page 17: Think Before You Submit Themes on WordPress dot Org

5.Style & Scripts

Page 18: Think Before You Submit Themes on WordPress dot Org

Requirements for Style and Scripts

1. Hardcoded style and script is not allowed.

2. Properly enqueue style, script and font.

3. No minification of scripts or files unless you provide original files.

4. By default, WordPress installation includes many popular scripts. Example:- jquery.js No need to enqueuer this.

Page 19: Think Before You Submit Themes on WordPress dot Org
Page 20: Think Before You Submit Themes on WordPress dot Org

6.Prefixing

Page 21: Think Before You Submit Themes on WordPress dot Org

Prefix everything with theme slug.

1. PHP function names.

2. PHP class names.

3. PHP global variables.

4. Action/Filter hooks.

5. Script handles.

6. Style handles.

7. Image size names.

Page 22: Think Before You Submit Themes on WordPress dot Org

“If your theme name is Japan Tokyo, your theme slug must be “japan-tokyo”

Page 23: Think Before You Submit Themes on WordPress dot Org
Page 24: Think Before You Submit Themes on WordPress dot Org

Prefix ExceptionNot necessary to prefix third party resources handle while enqueue style and scripts.

Page 25: Think Before You Submit Themes on WordPress dot Org

7.Security

Page 26: Think Before You Submit Themes on WordPress dot Org

Validation, Sanitization and Escaping

1. Validate and/or sanitize untrusted data before entering into the database. All untrusted data should be escaped before output.

2. Example: sanitize_email, esc_attr, esc_url, esc_html, absint etc.

Page 27: Think Before You Submit Themes on WordPress dot Org

Users Input

sanitize_email()Use to sanitize email before inserting data in database.

sanitize_text_field() Use to sanitize text field before entering the database.

absintUse to sanitize the absolute integer.

esc_url_raw()Use to sanitize URL value before intering the database.

sanitize_hex_color()Use to sanitize the color code before entering on database.

sanitize_key()Uppercase characters will be converted to lowercase.

Page 28: Think Before You Submit Themes on WordPress dot Org

User Input Example:

$wp_customize->add_setting( 'footer-copyright', array('capability' => 'edit_theme_options','default' => __('All Right Reserved 2017', 'text-domain'),'sanitize_callback' => ‘sanitize_text_field'

) );

$wp_customize->add_control( 'footer-copyright', array('label' => __( 'Copyright Text', ‘text-domain' ),'description' => __('Your Own Copyright Text', 'text-domain'),'section' => 'footer-option','settings' => 'footer-copyright','type' => 'text',

) );

Page 29: Think Before You Submit Themes on WordPress dot Org

Securing Output

esc_html()Securing output for HTML blocks.

esc_textarea() Escaping for textareavalues before output.

esc_attr()Escaping for HTML attributes.

esc_url()Use to escape URL while output.

absint()This is use for both input and output for absolute integer.

esc_js()Use this function for inline Javascript.

Page 30: Think Before You Submit Themes on WordPress dot Org

Secure Output Example

For escaping HTML, <?php echo esc_html( get_theme_mod('footer-copyright')); ?>

For escaping url, <?php echo esc_url( get_theme_mod(‘setting_id')); ?>

For escaping absolute integer,<?php echo absint( get_theme_mod(‘setting_id')); ?>

Page 31: Think Before You Submit Themes on WordPress dot Org

8.Language

Page 32: Think Before You Submit Themes on WordPress dot Org

Make your theme Translation ready.

1. All theme text strings are to be translatable.

2. Example: __( ‘ WordCamp Tokyo 2017‘, ‘text-domain‘ );

3._e( ‘ WordCamp Tokyo 2017‘, ‘text-domain‘ );

Page 33: Think Before You Submit Themes on WordPress dot Org

9.Content Creation

Page 34: Think Before You Submit Themes on WordPress dot Org

Content must remain as it is even theme switch

1. Content Creation like text area is not allowed.

2. Maximum repeater text field on customizer is not allowed.

3. Meta field is allowed only for design purpose.

Page 35: Think Before You Submit Themes on WordPress dot Org

10.Theme Options

Page 36: Think Before You Submit Themes on WordPress dot Org

Setting API vs Customizer API

1. Settings API is not allowed on theme for Theme Options. Use Customizer API to implement theme options.

2. Only one subpage is allowed under Appearance menu. It should contain relevant information about theme like documentation, user guide, etc.

3. Removing the core settings outside the customizer is not allowed.

4. You can reposition the options of the customizer.

Page 37: Think Before You Submit Themes on WordPress dot Org

11.Post Type

Page 38: Think Before You Submit Themes on WordPress dot Org

Custom Post types and taxonomies are not allowed.

Page 39: Think Before You Submit Themes on WordPress dot Org

12.Plugins

Page 40: Think Before You Submit Themes on WordPress dot Org

Plugin Territory

1. You are not allowed to bundle plugins in the theme.

2. Theme can recommend plugins and those plugins must be in dot org repository.

3. Theme should work good without any plugin.

4. You can recommend plugin with the help of library. ( Example: TGM Plugin Activation )

Page 41: Think Before You Submit Themes on WordPress dot Org

13.Shortcode

Page 42: Think Before You Submit Themes on WordPress dot Org

No shortcodesare allowed on theme.

Page 43: Think Before You Submit Themes on WordPress dot Org

14.Theme Codes

Page 44: Think Before You Submit Themes on WordPress dot Org

Check your every lines of code

1. Add a call to ‘wp_head()’ before the closing ‘</head>’ tag.

2. ‘body_class()’must be inside the opening body tag.

3. Use the ‘wp_footer()’ call, to appear just before closing body tag.

4. Use WordPress function to call templates. Example: get_header(), get_footer(), get_sidebar(), get_search_form() etc

Page 45: Think Before You Submit Themes on WordPress dot Org

15.Screenshot

Page 46: Think Before You Submit Themes on WordPress dot Org

1. No logo or mockup, actual layout of your theme is required.

2.Required size 4:3 aspect ratio.

3. Recommended size is 1200*900

Page 47: Think Before You Submit Themes on WordPress dot Org

16.Child Theme

Page 48: Think Before You Submit Themes on WordPress dot Org

Child Theme is also treated as a new theme and needs to follow the same queue.

1. Child theme name must not include parent theme name unless you are the author of the parent theme.

2. Theme must be child theme ready.

Page 49: Think Before You Submit Themes on WordPress dot Org

17.Other things you need to care about

Page 50: Think Before You Submit Themes on WordPress dot Org

1. W and P of WordPress always in uppercase.

2. Remove unnecessary commented code.

3. No customization in WordPress admin.

4. Redirection is not allowed after theme activated.

5. It’s not allowed to remove the default functionality of core.

6. Don’t include development files.

7. Premium Theme Shop should be GPL.

8. Don’t include backup files on theme folder.

9. No analytics or tracking.

10. No Sharing API is allowed. ( Facebook, twitter etc )

11. Save options on single array.

12. Not overriding admin bars.

Page 51: Think Before You Submit Themes on WordPress dot Org

13. No URL shorteners used in the theme.

14. All code and design should be your own or legally yours.

15. Use WordPress functionality and features first, if available.

16. You are not allowed to duplicate existing features.

17. Custom favicon is not allowed. It’s core functionality.

18. Check name collision.

19. Submit one theme at a time.

Page 52: Think Before You Submit Themes on WordPress dot Org

Are you still looking for best tips ?

Page 53: Think Before You Submit Themes on WordPress dot Org

Helpful tips for both author and reviewers.

Check Other Live Ticket Follow Theme guidelines Use #themereview Channel Slack

Start Reviewing Other Themes

Attend Channel Meeting

Contact with Mods and Admins

Page 54: Think Before You Submit Themes on WordPress dot Org

Check these things before theme submission.

PHP, JS and Browser Console warnings

Check with Theme check plugins

Check your theme code yourself once

Check changelog and theme version

Submit your theme from here: https://wordpress.org/themes/upload/

Page 55: Think Before You Submit Themes on WordPress dot Org

How theme review process works?

Wait Queue

for

Review

Rejected/

Approved

/Live

Submit

your

Theme

Review/Comm

unication with

reviewers

Page 56: Think Before You Submit Themes on WordPress dot Org

Credit

1. https://codex.wordpress.org/2. https://make.wordpress.org/themes/handbook/rev

iew/required/3. https://make.wordpress.org/themes/4. http://code.tutsplus.com/articles/data-

sanitization-and-validation-with-wordpress--wp-25536

5. https://wordpress.slack.com/messages/themereview

6. https://themes.trac.wordpress.org/

Page 57: Think Before You Submit Themes on WordPress dot Org

“This is Where My Presentation Ends And, Quality WordPress Theme Development Begins !

Page 58: Think Before You Submit Themes on WordPress dot Org
Page 59: Think Before You Submit Themes on WordPress dot Org

THANKS!

Any questions?

Lets connect,

Twitter: @sandilyakafleGoogle Plus: +SandilyaKafleSlack: kaflegEmail: [email protected]: www.kafleg.com.np