Genesis Sublime Text 2 Snippets

Below are some snippets I've gathered or created for the Sublime Text 2 Genesis Package. To start using the package follow the installation instructions located in the Github Repo. Thanks to anyone who has shared their snippets on their blog. If you have any snippets or a link to some snippets please drop it in the comments.

Add a custom class to the body

addbodyclass
add_filter( 'body_class', 'add_body_class' );
function add_body_class( $classes ) {
   $classes[] = 'someclass';
   return $classes;
}

Viewport Meta Tag

viewportmeta
add_action( 'genesis_meta', 'child_viewport_meta_tag' );
function child_viewport_meta_tag() {
	echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>';
}

Custom Footer

customfooter
remove_action( 'genesis_footer', 'genesis_do_footer' );
add_action( 'genesis_footer', 'child_do_footer' );
function child_do_footer() {
	// new footer code here
}

Custom Post Content

custompc
remove_action( 'genesis_post_content', 'genesis_do_post_content' );
add_action( 'genesis_post_content', 'prefix_do_post_content' );

function prefix_do_post_content() {
	// code here
}

Enable menu description

emd
function child_enable_menu_description( $item_output, $item ) {
	if ( ' ' !== $item->post_content )
		return preg_replace( '/(<a.*?>[^<]*?)</', '$1' . '<span>' . $item->post_content . '</span><',  $item_output );

	return $item_output;
}
add_filter( 'walker_nav_menu_start_el', 'child_enable_menu_description', 10, 2 );

Theme support for footer widgets

footerwidgets
add_theme_support( 'genesis-footer-widgets', 3 );

Full Width Page Layout

forcefull
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );

Genesis Custom Loop

gcl
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'prefix_do_loop' );
function prefix_do_loop() {
	global $paged;

	// any wp_query args
	$args = (array(
		'post_type'      => '',
		'category_name'  => 'Blog',
		'order'          => 'asc',
		'order_by'       => 'title',
	 	'paged'          => $paged,
	 	'posts_per_page' => 5
	));

	genesis_custom_loop( $args );
}

genesis();

Genesis Register Sidebar

grs
genesis_register_sidebar( array(
	'id'            => 'must-be-slug',
	'name'          => 'Can Have Spaces',
	'description'   => 'This is the Can Have Spaces section'
) );

Remove Breadcrumb

removebc
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );

Remove Post Title

removetitle
remove_action( 'genesis_post_title','genesis_do_post_title' );

Reposition Secondary Nav

repositionsubnav
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'genesis_before_header', 'genesis_do_subnav' );

Setup Page Template

setuptemplate
<?php
/*
	Template Name:  Template Name
*/
// add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
// remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
// remove_action( 'genesis_post_title', 'genesis_do_post_title' );
remove_action( 'genesis_post_content', 'genesis_do_post_content' );
add_action( 'genesis_post_content', 'prefix_do_post_content' );

function prefix_do_post_content() {
	// code here	
}

genesis();

Unregister Layouts

urlayouts
genesis_unregister_layout( 'content-sidebar' );
genesis_unregister_layout( 'sidebar-content' );
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
genesis_unregister_layout( 'sidebar-content-sidebar' );

Unregister Sidebar Alt

uralt
unregister_sidebar('sidebar-alt');

Unregister Superfish Scripts

ursuperfish
add_action( 'wp_enqueue_scripts', 'unregister_superfish' );
function unregister_superfish() {
	wp_deregister_script( 'superfish' );
	wp_deregister_script( 'superfish-args' );
}

Remove Footer and Footer Markup

removefooter
remove_action('genesis_footer', 'genesis_do_footer');
remove_action('genesis_footer', 'genesis_footer_markup_open', 5);
remove_action('genesis_footer', 'genesis_footer_markup_close', 15);

Custom Search Text

customsearchtext
add_filter('genesis_search_text', 'child_theme_search_text');
function child_theme_search_text( $text ) {
	return esc_attr( 'Search' );
}

Custom Search Button Text

customsearchbutton
add_filter('genesis_search_button_text', 'child_theme_search_button_text');
function child_theme_search_button_text( $text ) {
	return esc_attr( 'Go' );
}

Child Theme Setup

childthemesetup
/**
 * Theme Setup
 *
 * This setup function attaches all of the site-wide functions 
 * to the correct hooks and filters. All the functions themselves
 * are defined below this setup function.
 */

add_action( 'genesis_setup', 'child_theme_setup', 15 );
function child_theme_setup() {
	// ** Backend **
	// add actions here

	// ** Frontend **
	// add actions here

}

// define functions here

Structural Wraps

structuralwraps
add_theme_support( 'genesis-structural-wraps', array( 'inner' ) );

Filter Excerpt More

filterexcerptmore
add_filter( 'excerpt_more', 'child_theme_excerpt_more' );
function child_theme_excerpt_more( $more ) {
	return '...';
}