Below is a list of the most common best practices you should follow when building sites off of the Genesis Framework.
Click each link to learn more:
- Use Genesis Coding Conventions
- WordPress®/PHP Compatibility 1
- Custom/Genesis Functions
- Naming/Checking Functions
- Loading jQuery Scripts
- Stylesheet Header
Use Genesis Coding Conventions
Genesis Coding Conventions are essentially the same as the WordPress coding standards when writing code (no PHP shortcode, properly indented, spaces within brackets and around args, etc). Remember to add comment code where necessary.
WordPress/PHP Compatibility
Making sure that your theme is compatible is a must when using the current Genesis version. PHP compatibility must meet current WordPress requirements. If you find that you must use other PHP, make sure it fails gracefully on “lesser” servers.
Custom/Genesis Functions
When writing custom functions to replace existing Genesis functions, respect the structure and content of the underlying function. For example, if an existing function provides a filter on the output, the replacement function should do the same. Re-use Genesis functions rather than writing your own.
Naming/Checking Functions
In regard to function naming, include the childthemename in the function name. For example, if replacing genesis_do_post_title with your own function, name it childthemename_do_post_title. The same applies to custom filter functions. Use function_exists for conditional loading of a third party (ie: external plugin) function. Not required for Genesis or child theme-defined functions.
Loading jQuery Scripts
Don’t load jQuery framework (or any other framework shipped with WordPress) from external sources without using wp_deregister_script to deregister the built-in version and wp_register_script to register the new one, etc.
Stylesheet Header
Below is the recommended way to build your Genesis child theme style sheet header:
- Theme Name: The name of the child theme. You can change this to read as you like.
- Theme URI: The link where the child theme can be downloaded or purchased.
- Description: A description of the child theme and list the features that come with it.
- Author: Identify the individual or company that developed the child theme.
- Author URI: The link for the individual or company that developed the child theme.
- Version: Specify the version of your child theme.
- Tags: This is where you can specify certain features of the child theme. (See the WordPress tags list.)
- Template: This tells the child theme to run off the Genesis Framework and is required for the child theme to function properly.
- Template Version: The minimum version of the Genesis Framework that is required for the child theme to function properly.
- License: Specify the type of license that you are releasing the child theme under.
- License URI: The link for the license that you are releasing the child theme under.
