Best Practices When Building WIth Genesis

Below is a list of the most common best practices you should follow when building sites off of the Genesis Framework.

General Best Practices

1. Use Genesis Coding Conventions
These are basically WordPress coding standards when writing code (no PHP shortcode, properly indented, spaces within brackets and around args, etc). Comment code where necessary.

2. WordPress/PHP Compatibility
Making sure that your theme is compatible is a must when using the current Genesis version. PHP compatibility must be as per current WordPress requirements. If you really, really must use some PHP latest funky function, make sure it fails gracefully on “lesser” servers.

3. Custom/Genesis Functions
When writing custom functions to replace existing Genesis functions, respect the structure and content of the underlying function. Eg, 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.

4. Naming/Checking Functions
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. 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.

5. 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: Sample
	Theme URI: http://www.yourdomain.com/
	Description: This is a sample child theme created for the Genesis Framework.
	Author: Your Business Name
	Author URI: http://www.yourbusiness.com/

	Version: 1.0

	Tags: custom-background, custom-header, featured-images, threaded-comments, two-columns

	Template: genesis
	Template Version: 1.7.1

	License: GNU General Public License v2.0
	License URI: http://www.opensource.org/licenses/gpl-license.php
*/

Theme Name
This is the name of the child theme – you can change this to read as you like.

Theme URI
This is the link where the child theme can be downloaded or purchased.

Description
This is where you can describe the child theme and list the features that come with it.

Author
This is where you can identify the individual or company that developed the child theme.

Author URI
This is the link for the individual or company that developed the child theme.

Version
This is where you specify the version of your child theme.

Tags
This is where you can specify certain features of the child theme. (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
This is the minimum version of the Genesis Framework that is required for the child theme to function properly.

License
This is where you specify the type of license that you are releasing the child theme under.

License URI
This is the link for the license that you are releasing the child theme under.