Skip to content

Instantly share code, notes, and snippets.

@braddalton
Created November 17, 2013 06:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save braddalton/235e6afe28793b319046 to your computer and use it in GitHub Desktop.
Save braddalton/235e6afe28793b319046 to your computer and use it in GitHub Desktop.
<?php
/**
* This file adds the Home Page to the Agency Pro Theme.
*
* @author StudioPress
* @package Agency Pro
* @subpackage Customizations
*/
add_action( 'genesis_meta', 'agency_home_genesis_meta' );
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function agency_home_genesis_meta() {
if ( is_active_sidebar( 'home-middle' ) ) {
//* Force content-sidebar layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
//* Add agency-home body class
add_filter( 'body_class', 'agency_body_class' );
//* Remove breadcrumbs
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
//* Remove the default Genesis loop
remove_action( 'genesis_loop', 'genesis_do_loop' );
//* Add homepage widgets
add_action( 'genesis_loop', 'agency_homepage_widgets' );
//* Modify length of post excerpts
add_filter( 'excerpt_length', 'agency_home_excerpt_length' );
}
}
function agency_body_class( $classes ) {
$classes[] = 'agency-pro-home';
return $classes;
}
function agency_homepage_widgets() {
genesis_widget_area( 'home-middle', array(
'before' => '<div id="home-middle" class="home-middle widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
}
function agency_home_excerpt_length( $length ) {
return 35;
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment