In ThemeShaper have created a guide for any developer who wants to create a Wordpress theme that meets all standards , so as to offer the best experience purely WordPress.
The guide is intended for developers to WordPress.com issues but is equally useful for any WordPress environment . And what I think is a tremendous interest in Spanish here it is ...
Escapes
- All dynamic data must be escaped with esc_attr () before being delivered as HTML attributes
- All dynamic urls must be escaped with esc_url () .
- If the dynamic data are delivered as an attribute of an HTML script element must be escaped with esc_js () .
- SQL queries containing dynamic data must be escaped with $ WPDB-> prepare () .
- All text visible to the user should be prepared for translation.
- Avoid HTML into chains of functions "gettext" whenever possible.
- The output of sprintf () must be escaped in the text strings used in the attributes.
- Locators printf () must be escaped before inclusion in HTML attributes.
- Provides context where needed.
- Avoid anti-patterns common.
Requests (queries)
- Direct SQL requests should be avoided. It is best to use one of the new objects WP_Query when possible.
- They can be used unlimited requests. Basically, this means that the parameter posts_per_page of WP_Query not be set to -1 . Furthermore, the parameter numberposts of get_posts () (and similar functions) must also have a positive value.
- The large requests be cached so transient .
- Can not use query_posts () . If you need to modify the main demand is better to use the filter pre_get_posts . If you need to retrieve entries besides the main request is best to use the new object WP_Query .
- Empty values should not be passed to the argument post__in used to create a new WP_Query . If you're using a dynamic value that should be empty is important to make sure it is empty before using the value in the request ( example ).
- Requests for terms to be checked in a facility that has 10,000 terms.
Submissions to the queue ( enqueues )
- All others including files must be compatible with the license GPL .
- Make sure you use the appropriate protocol to put others on hold files.
- Make sure you use the appropriate hooks to put on hold scritpts and styles.
Scripts
- Use the scripts included in the standard installation if any.
- Custom scripts should not be minimized.
- The scripts include third-party can not be minimized but should include the following:
- The name of the library.
- Version Number
- License
- URL
Styles
- The main stylesheet (style.css) it must hold for the action wp_enqueue_scripts .
- Never use overflow: hidden to contain floating objects (floats). A better alternative is to use micro clearfix .
- The key ! important should not be used where a specification is sufficient.
- Putting on Google expects a source of several blocks of characters includes conditionally blocks with gettext.
- Are not permitted in the style attributes HTML tags.
Conflict with plugins
The environment WordPress.com is overloaded with a lot of plugins that provide functionality shared by all threads. To give users a consistent experience should not be included in the topics that duplicate functionality of plugins. This should also be applicable to other settings.
When designing themes for WordPress.com this is what is used:
- Advertising options are managed WordAds .
- Custom color settings are managed with the plugin Custom Colors .
- Custom font settings are managed with the plugin Custom Fonts .
- The favicons are managed with the plugin Blavatar .
- Support is used HiDPI for pictures uploaded by users
- The infinite scroll it offers Jetpack .
- Open Graph Protocol
- Support Twitter meta tag
- Different widgets
Data Portability
Ensure that user content does not change when the subject is very important. The following features of the standard installation of WordPress, but are great by themselves, can cause a change in the content of the user or may not be available if activated from the topic.
- Entry Types personalize public
- Public custom taxonomies
- Custom Fields field goal or tickets
- Shortcodes (shortcodes)
Theme Options
If your theme includes custom settings is highly recommended to use the customizer instead of a custom screen management. Doing so has many advantages:
- Users can see your changes immediately, as it adapts to the user interface.
- You have to write a lot less code.
- You have user interface modules for most common situations.
If your item needs to offer a management screen custom settings these are the requirements:
- Must be a child menu Appearance menu, with the title "Theme Options".
- It requires the use of the Settings API in WordPress.
- All adjustments should save an "array" series.
- The default settings should not be inserted in the database until the installation or an http request.
- All values must be sanitized before storing them in the database.
- You must use the functionality of the standard installation for any need for file uploads.
Most of these requirements, if not all, are in the sample settings file topics for beginners .
Miscellaneous
- They used the "loops" complete in all templates. It is not enough simply to call the_post () in single.php or page.php template how.
- The $ content_width overall should be well defined.
Usability Guides
The unit test data for WordPress.org themes is full of entries and pages designed to carry your theme to its limits. Download the data and import them to your test server. Test your theme with all available tests will help you ensure that your topic will be flexible enough to handle a wide variety of real user data.
Resources
- These instructions should be used in conjunction with the guidelines of Theme Review .
- WordPress Codex , the online manual for WordPress and live stock WordPress documentation.
- The tutorial topics ThemeShaper WordPress Theme Tutorial: Second Edition
- You should either know the subject _s , also known as underlined .
- Developer is a plugin that encourages you to install a number of plugins useful for development, including Theme Check , VIP Scanner , and Monster Widget .
Translation (something free but required in vital) of Theme guide







Great article with a great content. As a Wordpress user I have seen so many Wordpress users just using Wordpress without knowing the what Wordpress can do. This would be a great help for them.
ReplyDeleteActually I’m like to create several kinds of blogs. I used blog spot and word press.
ReplyDeleteThere have a to z information about create blog with word press.