Site icon WP Smith

An Introduction to Genesis 1.8 with Examples

Genesis 1.8 Beta is out today with over 80 fixes, improvements, and enhancements. This is the first release that I was lucky enough to have some direct contributions (previously my contributions were made through the Genesis Development forum, which had to be recommended to the developers via another person). Let's review some of what I believe to be some extremely important updates and improvements. If you are not a ProPlus Member, become one today to get the Beta version.

In short, as Gary aptly describes: Genesis 1.8 is...

A major release which saw the addition of a native color style setting box for child themes, a set of classes that make adding new pages in child themes considerably easier, several bits of functionality to make customising themes easier, a new default look including responsive design, a documentation and code standards overhaul, a rewrite of the admin JavaScript, and a slight change to a less restrictive license.

Here's a review of some of the many changes to be seen:

User Interface Updates

Sometimes it's about the little things. In Genesis 1.8, there are the following:

General Updates (Widgets, Readme, Misc)

Various other updates include improved images (favicon, screenshot), default footer wording credits, updated Readme, improved eNews, Header Right(/Left). The user profile dropdowns now include those who have posts. One of the good upcoming updates is that Genesis will deprecate Genesis Page and Category Menu from core. Genesis 1.8 only includes a warning that this is coming.

Developer Updates

So from a developer's perspective, Genesis 1.8 has made many and bountiful enhancements and improvements making development, even rapid development, extremely easy including many one line coding options and the admin class to make creating admin pages simpler. This is what I am the most excited about.

Genesis Admin Class

First and foremost is the new admin class making developing admin pages simple. All the Genesis admin pages were re-developed according to the class adding new filters and new hooks. If we were to develop a new child theme settings, page we simply just extend whichever class we'd like the Genesis_Admin_Boxes (which displays metaboxes and are used by the theme settings admin page and the SEO settings admin page) or Genesis_Admin_Form, which has no example in Genesis Core. Once could even use the Genesis_Admin_Basic, which the import/export pages are built upon. Furthermore, Admin class makes contextual help as easy as creating a help() method. For more information on the new Genesis Admin Class, see my Metabox Example here: How to Use the New Genesis Admin Class: Metabox Example

New Genesis Filters

There are also a few new filters beside the one previously mentioned. They are:

[php]
// Remove edit link
add_filter ( 'genesis_edit_post_link' , '__return_false' );
[/php]

[php]
// Change term_meta & prevent & changes
add_filter ( 'genesis_term_meta' , 'wps_term_meta' );
function ( $term_meta ) {
return array(
'headline' => '',
'intro_text' => '',
'display_title' => 0, /** vestigial */
'display_description' => 0, /** vestigial */
'doctitle' => '',
'description' => '',
'keywords' => '',
'layout' => '',
'noindex' => 0,
'nofollow' => 0,
'noarchive' => 0,
);
}
[/php]

Or, via per term field:

[php]
// Change term_meta headline & prevent & changes for all terms
add_filter ( 'genesis_term_meta_headline' , 'wps_term_meta_headline' , 10 , 3 );
function wps_term_meta_headline ( $term_meta , $term , $taxonomy ) {
return $taxonomy . ': ' . $term ;
}
[/php]

[php]
// Adds accessibility label
add_filter ( 'genesis_search_form_label' , 'wps_search_form_label' );
function wps_search_form_label ( $label ) {
return '<label for="s">' . __( 'Search this Site' ) . '</label>';
}
[/php]

[php]
// Set default custom background color & image
add_filter ( 'genesis_custom_header_defaults' , 'wps_search_form_label' );
function wps_search_form_label ( $label ) {
return array(
'width' => 960,
'height' => 80,
'textcolor' => '333333',
'no_header_text' => false,
'header_image' => '%s/images/header.png',
'header_callback' => 'genesis_custom_header_style',
'admin_header_callback' => 'genesis_custom_header_admin_style',
);
}
[/php]

[php]
// Change Previous Page text
add_filter ( 'genesis_prev_link_text' , 'wps_prev_link_text' );
function wps_prev_link_text ( $text ) {
return g_ent( '« ' ) . __( 'Previous Page', CHILD_DOMAIN );
}

// Change Next Page text
add_filter ( 'genesis_next_link_text' , 'wps_next_link_text' );
function wps_next_link_text ( $text ) {
return g_ent( '« ' ) . __( 'Next Page', CHILD_DOMAIN );
}
[/php]

Genesis Menus Theme Support

Then there is the ability to dynamically register/unregister nav menus in functions.php via add_theme_support(). For example:

[php]
// Default Menus: registers Primary and Secondary
add_theme_support ( 'genesis-menus' , array ( 'primary' => 'Primary Navigation Menu' , 'secondary' => 'Secondary Navigation Menu' ) );

// Changes Default to Primary & Footer
add_theme_support ( 'genesis-menus' , array ( 'primary' => 'Primary Navigation Menu' , 'footer' => 'Footer Navigation Menu' ) );

// Remove Custom Menu support
remove_theme_support ( 'genesis-menus' );
[/php]

Color Switcher

Next, there is the Genesis easy color switcher that adds a body class to build in multiple theme colors. To really see a good example of this, see AgentPress 2's CSS file at the bottom for those who are ProPlus Members.

[php]
/** Create additional color style options */
add_theme_support( 'genesis-style-selector', array( 'agentpress-gray' => 'Gray', 'agentpress-green' => 'Green', 'agentpress-red' => 'Red', 'agentpress-tan' => 'Tan' ) );
[/php]

Genesis Widget Area

Finally, props to Nick_theGeek for this really cool new addition for child theme developers is the new genesis_widget_area(). Instead of using !dynamic_sidebar() or is_active_sidebar(), a child theme developer can use genesis_widget_area() for home page development. For example, instead of...

[php]
if ( is_active_sidebar( 'home' ) || is_active_sidebar( 'home-left' ) || is_active_sidebar( 'home-right' ) ) {

dynamic_sidebar( 'home' );

if ( is_active_sidebar( 'home-left' ) ) {
echo '</pre>
<div id="homepage-left">';
dynamic_sidebar( 'home-left' );
echo '</div>
<pre>
<!-- end #homepage-left -->';
}

if ( is_active_sidebar( 'home-right' ) ) {
echo '</pre>
<div id="homepage-right">';
dynamic_sidebar( 'home-right' );
echo '</div>
<pre>
<!-- end #homepage-right -->';
}

}
else {
genesis_standard_loop();
}
[/php]

you could have...

[php]
if ( ! genesis_widget_area( 'home', array( 'before' => '' , 'after' => '' ) ) && ! genesis_widget_area( 'home-left' ) && ! genesis_widget_area( 'home-right' ) )
genesis_standard_loop();
[/php]

Designer Updates

From a designer's perspective (which is not my forte), responsive design was introduced & menu CSS was drastically reduced. See Brian’s post for a great explanation.

Summary

Genesis 1.8 Beta is out with a force with a massive collection of some excellent upgrades, improvements, and fixes! If you are not a ProPlus Member, become one today to get the Beta version now!