These are the rules to follow while developing a new WordPress theme.

The Roots Of Our Structure

We follow the Underscores structure(_s) since it is a simple and popular framework. It is easy to use and understand for every WordPress community member.

WordPress Coding Standards

Since we are working with WordPress, we respect the environment, concepts and coding standards.

Aside from the rules from Codex we also need to check:

Simple Quotes First

The simple quotes ' should always be your fist pick, excepting the case of HTML attributes. So:

HTML Escape

Every string must be output in an escaped way with gettext functions like esc_html__ or esc_html_e:

Javascript parameters

Always localize JavaScript strings or parameters needed (here is an example).

PHP function naming

Every PHP function must be prefixed with the theme name like this: guides_get_option.

PHP functions naming should also be completed by these 2 rules:

Actions and Filters

Since the use of actions and filters is a day by day job in themes and plugins, they turn out to be pretty important. Also how we organize them is a fact that requires attention, so:

1) Avoid putting actions and filters directly in functions.php, try to find a file with context like template-tags.php or extras.php.

2) If is a plugin based action, there is a folder integrations exactly for this purpose.

3) We recommend writing actions and filters like the following example

” | markdownify }}

<?php
/**
 * Comment block. Explain here what this function does!
 **/
function my_custom_action ( $first_param, $second_param ) {

   // do some custom work

}
add_action( 'init', 'my_custom_action', 10, 2 ); ?>

/theme/code_style.png)

Please note that this code style is available only for PHP files.

For SCSS, CSS or JS files you will need to setup your own style and add Smart Tabs or a proper spacing to function parameters.

A Child Theme’s Perspective

Plugins Integrations

  1. We strive to keep things licensed under GPLv3. The sky is the limit.