In a nutshell, WP themes are files that combine in order to create and maintain a WordPress site. Each theme can be different, but the duty of each file remains the same. Let’s take a look at the WP theme development standards you should bear in mind when working on your WordPress custom themes.
WordPress Custom Themes Development Standards
When coding your WP theme, there are are 3 fundamental standards:
- Employ well-structured PHP that is error-free, as well as valid HTML
- Employ clean and valid CSS
- Ensure that your design and layout standards are up to scratch
WordPress Coding Standards
With your WordPress theme design, you must adhere to certain coding standards. These standards were developed by the WP community, and although you are in no way legally bound to adhere to the standards, it is recommended that you do so.
Coding standards ensure that you avoid niggling coding errors; they also allow the opportunity for collaboration, and improve the readability of the code. There are 4 types of coding standards that it is recommended you read up about:
- CSS coding standards
- HTML coding standards
- PHP coding standards
CSS Coding Standards
The main purpose of CSS is coding standards to ensure that your code is readable, consistent, meaningful, and pleasing on the eye.
When structuring a stylesheet, it is important to bear in mind the following points:
- Always use tabs instead of spaces
- Separate sections two blank lines and blocks with a single blank line
- All selectors have to be on their own line
When creating selectors, please bear in mind the following:
- Always use lowercase
- Use hyphens to separate words
- Employ double quotes and values for attribute selectors
- Do not use over-qualified selectors
As the guidelines for site design and layout are complex and numerous, we recommend that you visit WordPress’ online community manual for help: https://codex.wordpress.org/Site_Design_and_Layout
In case you have any questions left feel free to use our development services.