Think Before You Submit Themes on WordPress dot Org
-
Upload
kafle-g -
Category
Technology
-
view
1.631 -
download
0
Transcript of Think Before You Submit Themes on WordPress dot Org
HELLO!
Ganga Kafle
Co-Founder / Partner of Acme Themes
Co-Owner of Template Sell
Think Before You Submit Themes on WordPress.Org
Should my theme be based on standards?
1.Setup Theme Development Environment
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
2.What are the Theme Standards? What your theme should have?
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.
3.style.css Components
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 */
4.The GPL License
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
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
License declared on readme.txt file
5.Style & Scripts
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.
6.Prefixing
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.
“If your theme name is Japan Tokyo, your theme slug must be “japan-tokyo”
Prefix ExceptionNot necessary to prefix third party resources handle while enqueue style and scripts.
7.Security
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.
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.
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',
) );
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.
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')); ?>
8.Language
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‘ );
9.Content Creation
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.
10.Theme Options
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.
11.Post Type
Custom Post types and taxonomies are not allowed.
12.Plugins
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 )
13.Shortcode
No shortcodesare allowed on theme.
14.Theme Codes
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
15.Screenshot
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
16.Child Theme
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.
17.Other things you need to care about
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.
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.
Are you still looking for best tips ?
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
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/
How theme review process works?
Wait Queue
for
Review
Rejected/
Approved
/Live
Submit
your
Theme
Review/Comm
unication with
reviewers
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/
“This is Where My Presentation Ends And, Quality WordPress Theme Development Begins !
THANKS!
Any questions?
Lets connect,
Twitter: @sandilyakafleGoogle Plus: +SandilyaKafleSlack: kaflegEmail: [email protected]: www.kafleg.com.np