Last active
August 29, 2015 14:08
-
-
Save jaygidwitz/0bff575deecd0ad9038c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
/* | |
* Template Name: Welcome Page | |
* | |
* This file adds the Home Page to the Agency Pro Theme. | |
* | |
* @author StudioPress | |
* @package Agency Pro | |
* @subpackage Customizations | |
*/ | |
add_action( 'wp_enqueue_scripts', 'agency_welcome_enqueue_scripts' ); | |
/** | |
* Enqueue Scripts | |
*/ | |
function agency_welcome_enqueue_scripts() { | |
if ( is_active_sidebar( 'welcome-top' ) || is_active_sidebar( 'welcome-middle' ) || is_active_sidebar( 'welcome-bottom' ) ) { | |
wp_enqueue_script( 'scrollTo', get_stylesheet_directory_uri() . '/js/jquery.scrollTo.min.js', array( 'jquery' ), '1.4.5-beta', true ); | |
wp_enqueue_script( 'localScroll', get_stylesheet_directory_uri() . '/js/jquery.localScroll.min.js', array( 'scrollTo' ), '1.2.8b', true ); | |
wp_enqueue_script( 'home', get_stylesheet_directory_uri() . '/js/home.js', array( 'localScroll' ), '', true ); | |
} | |
} | |
add_action( 'genesis_meta', 'necronomicon_welcome_genesis_meta' ); | |
/** | |
* Add widget support for homepage. If no widgets active, display the default loop. | |
* | |
*/ | |
function necronomicon_welcome_genesis_meta() { | |
if ( is_active_sidebar( 'welcome-top' ) || is_active_sidebar( 'welcome-middle' ) || is_active_sidebar( 'welcome-bottom' ) ) { | |
//* Force content-sidebar layout setting | |
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); | |
//* Add agency-pro-home body class | |
add_filter( 'body_class', 'agency_welcome_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 home-top | |
add_action( 'genesis_after_header', 'agency_welcome_top' ); | |
//* Add homepage widgets | |
add_action( 'genesis_loop', 'agency_welcome_widgets' ); | |
//* Modify length of post excerpts | |
add_filter( 'excerpt_length', 'agency_welcome_excerpt_length' ); | |
} | |
} | |
function agency_welcome_body_class( $classes ) { | |
$classes[] = 'agency-pro-home'; | |
return $classes; | |
} | |
function agency_welcome_top() { | |
genesis_widget_area( 'welcome-top', array( | |
'before' => '<div id="welcome-top" class="welcome-top widget-area"><div class="wrap">', | |
'after' => '</div></div>', | |
) ); | |
} | |
function agency_welcome_widgets() { | |
genesis_widget_area( 'welcome-middle', array( | |
'before' => '<div id="welcome-middle" class="welcome-middle widget-area"><div class="wrap">', | |
'after' => '</div></div>', | |
) ); | |
genesis_widget_area( 'welcome-bottom', array( | |
'before' => '<div id="welcome-bottom" class="welcome-bottom widget-area"><div class="wrap">', | |
'after' => '</div></div>', | |
) ); | |
} | |
function agency_welcome_excerpt_length( $length ) { | |
return 35; | |
} | |
genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment