Created
February 14, 2014 22:05
-
-
Save derekperkins/9010382 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 | |
// This file adds the Home template to the Ackermania Theme. | |
// Template Name: Home | |
//Remove the site inner wrap using Genesis Structural Wraps | |
add_theme_support( 'genesis-structural-wraps', array( 'header', 'nav', 'subnav', 'footer-widgets', 'footer' ) ); | |
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); | |
remove_action( 'genesis_loop', 'genesis_do_loop' ); | |
add_action('genesis_loop', 'ac_bands'); | |
function ac_bands() { | |
if (!function_exists('types_render_field')) { | |
return; | |
} | |
ac_make_band(ac_home_feature()); | |
ac_make_band(types_render_field('online-video-marketing'), types_render_field('online-video-marketing-title')); | |
ac_make_band(types_render_field('meet-us'), types_render_field('meet-us-title')); | |
} | |
function ac_home_feature() { | |
$headline = types_render_field('main-headline'); | |
$leftContent = types_render_field('home-feature-left'); | |
$leftTitle = types_render_field('home-feature-left-title', array("output" => "raw")); | |
$leftTagline = types_render_field('home-feature-left-tagline', array("output" => "raw")); | |
$leftButton = types_render_field('home-feature-left-button', array("output" => "raw")); | |
$rightContent = types_render_field('home-feature-right'); | |
$rightTitle = types_render_field('home-feature-right-title', array("output" => "raw")); | |
$rightTagline = types_render_field('home-feature-right-tagline', array("output" => "raw")); | |
$rightButton = types_render_field('home-feature-right-button', array("output" => "raw")); | |
ob_start(); | |
?> | |
<h1 class="myslabtext textcenter"><span class="slabtext"><?= $headline; ?></span></h1> | |
<section class="home-feature-1"> | |
<?php | |
if (!empty($leftTitle)) { | |
?> <h2 class=""><?= $leftTitle; ?></h2> <?php | |
} | |
if (!empty($leftTagline)) { | |
?> <div class='tagline'><?= $leftTagline; ?></div> <?php | |
} | |
if (!empty($leftContent)) { | |
?> <?= $leftContent; ?> <?php | |
} | |
if (!empty($leftButton)) { | |
?> <a class="button large" href="http://ackermaniacreative.com/contact/"><?= $leftButton; ?></a> <?php | |
} | |
?> | |
</section> | |
<section class="home-feature-2"> | |
<?php | |
if (!empty($rightTitle)) { | |
?> <h2 class=""><?= $rightTitle; ?></h2> <?php | |
} | |
if (!empty($rightTagline)) { | |
?> <div class='tagline'><?= $rightTagline; ?></div> <?php | |
} | |
if (!empty($rightContent)) { | |
?> <?= $rightContent; ?> <?php | |
} | |
if (!empty($rightButton)) { | |
?> <a class="button large" href="http://ackermaniacreative.com/contact/"><?= $rightButton; ?></a> <?php | |
} | |
?> | |
</section> | |
<?php | |
return ob_get_clean(); | |
} | |
/** | |
* Create bands for the home page | |
* @param html $content complete HTML for the band | |
* @param string $title Band Title | |
* @param string $class Can be: home-feature-bg, home-feature-bg-alt, or home-feature-bg-dark | |
* @return null | |
*/ | |
function ac_make_band($content, $title = '', $class = 'home-feature-bg') { | |
if (empty($content)) { | |
return; | |
} | |
?> | |
<section class='<?= $class; ?>'> | |
<div class='wrap'> | |
<?php | |
if (!empty($title)) { | |
?> <h2 class="myslabtext textcenter"><span class="slabtext"><?= $title; ?></span></h2> <?php | |
} | |
?> | |
<?= $content; ?> | |
</div> | |
</section> | |
<?php | |
} | |
function epik_home_genesis_meta() { | |
if ( is_active_sidebar( 'slider-wide' ) || is_active_sidebar( 'slider' ) || is_active_sidebar( 'welcome-wide' ) || is_active_sidebar( 'welcome-feature-1' ) || is_active_sidebar( 'welcome-feature-2' ) || is_active_sidebar( 'welcome-feature-3' ) || is_active_sidebar( 'home-feature-4' ) || is_active_sidebar( 'home-feature-5' ) || is_active_sidebar( 'home-feature-6' ) || is_active_sidebar( 'home-feature-7' ) || is_active_sidebar( 'home-feature-8' ) || is_active_sidebar( 'home-feature-9' ) || is_active_sidebar( 'home-feature-10' ) || is_active_sidebar( 'home-feature-11' ) || is_active_sidebar( 'home-feature-12' ) || is_active_sidebar( 'home-feature-13' ) || is_active_sidebar( 'home-feature-14' ) ) { | |
remove_action( 'genesis_loop', 'genesis_do_loop' ); | |
/* add_action( 'genesis_after_header', 'epik_home_loop_helper_top' ); | |
add_action( 'genesis_after_header', 'epik_home_loop_helper_welcome' ); | |
add_action( 'genesis_after_header', 'epik_home_loop_helper_middle' ); | |
add_action( 'genesis_after_header', 'epik_home_loop_helper_mid_bottom' ); | |
add_action( 'genesis_after_header', 'epik_home_loop_helper_bottom' );*/ | |
} | |
} | |
/** | |
* Display widget content for "Slider Wide" and "Slider" sections. | |
* | |
*/ | |
function epik_home_loop_helper_top() { | |
genesis_widget_area( 'slider-wide', array( | |
'before' => '<div class="slider-wide"><div class="wrap">', | |
'after' => '</div></div>', | |
) ); | |
genesis_widget_area( 'slider', array( | |
'before' => '<div class="slider"><div class="wrap">', | |
'after' => '</div></div>', | |
) ); | |
} | |
/** | |
* Display widget content for the "Welcome-wide", "Welcome Feature 1", "Welcome Feature 2", and "Welcome Feature 3" sections. | |
* | |
*/ | |
function epik_home_loop_helper_welcome() { | |
if ( is_active_sidebar( 'welcome-wide' ) || is_active_sidebar( 'welcome-feature-1' ) || is_active_sidebar( 'welcome-feature-2' ) || is_active_sidebar( 'welcome-feature-3' ) ) { | |
echo '<div class="welcome"><div class="wrap">'; | |
genesis_widget_area( 'welcome-wide', array( | |
'before' => '<div class="welcome-wide">', | |
'after' => '</div>', | |
) ); | |
echo '<div class="welcome-features">'; | |
genesis_widget_area( 'welcome-feature-1', array( | |
'before' => '<div class="welcome-feature-1">', | |
'after' => '</div>', | |
) ); | |
genesis_widget_area( 'welcome-feature-2', array( | |
'before' => '<div class="welcome-feature-2">', | |
'after' => '</div>', | |
) ); | |
genesis_widget_area( 'welcome-feature-3', array( | |
'before' => '<div class="welcome-feature-3">', | |
'after' => '</div>', | |
) ); | |
echo '</div><!-- end .welcome-features --></div><!-- end .wrap --></div><!-- end #welcome -->'; | |
} | |
} | |
/** | |
* Display widget content for "Home Feature 1, 2, 3, and 4" sections. | |
* | |
*/ | |
function epik_home_loop_helper_middle() { | |
if ( is_active_sidebar( 'home-feature-1' ) || is_active_sidebar( 'home-feature-2' ) ) { | |
echo '<div class="home-feature-bg-alt"><div class="wrap">'; | |
genesis_widget_area( 'home-feature-1', array( | |
'before' => '<div class="home-feature-1">', | |
'after' => '</div>', | |
) ); | |
genesis_widget_area( 'home-feature-2', array( | |
'before' => '<div class="home-feature-2">', | |
'after' => '</div>', | |
) ); | |
echo '</div><!-- end .wrap --></div><!-- end #home-feature-bg-alt -->'; | |
} | |
genesis_widget_area( 'home-feature-3', array( | |
'before' => '<div class="home-feature-bg"><div class="wrap"><div class="home-feature-3">', | |
'after' => '</div></div></div>', | |
) ); | |
genesis_widget_area( 'home-feature-4', array( | |
'before' => '<div class="home-feature-bg-alt"><div class="wrap"><div class="home-feature-4">', | |
'after' => '</div></div></div>', | |
) ); | |
} | |
/** | |
* Display widget content for "Home Feature 5, 6, 7, and 8" sections. | |
* | |
*/ | |
function epik_home_loop_helper_mid_bottom() { | |
genesis_widget_area( 'home-feature-5', array( | |
'before' => '<div class="home-feature-bg-dark"><div class="wrap"><div class="home-feature-5">', | |
'after' => '</div></div></div>', | |
) ); | |
genesis_widget_area( 'home-feature-6', array( | |
'before' => '<div class="home-feature-bg-alt"><div class="wrap"><div class="home-feature-6">', | |
'after' => '</div></div></div>', | |
) ); | |
genesis_widget_area( 'home-feature-7', array( | |
'before' => '<div class="home-feature-bg"><div class="wrap"><div class="home-feature-7">', | |
'after' => '</div></div></div>', | |
) ); | |
genesis_widget_area( 'home-feature-8', array( | |
'before' => '<div class="home-feature-bg-alt"><div class="wrap"><div class="home-feature-8">', | |
'after' => '</div></div></div>', | |
) ); | |
} | |
/** | |
* Display widget content for the "Home Feature 9, 10, 11, 12, 13, and 14" sections. | |
* | |
*/ | |
function epik_home_loop_helper_bottom() { | |
if ( is_active_sidebar( 'home-feature-9' ) || is_active_sidebar( 'home-feature-10' ) || is_active_sidebar( 'home-feature-11' ) || is_active_sidebar( 'home-feature-12' ) || is_active_sidebar( 'home-feature-13' ) ) { | |
echo '<div class="home-feature-bg"><div class="wrap">'; | |
genesis_widget_area( 'home-feature-9', array( | |
'before' => '<div class="home-feature-9">', | |
'after' => '</div>', | |
) ); | |
genesis_widget_area( 'home-feature-10', array( | |
'before' => '<div class="home-feature-10">', | |
'after' => '</div>', | |
) ); | |
genesis_widget_area( 'home-feature-11', array( | |
'before' => '<div class="home-feature-11">', | |
'after' => '</div>', | |
) ); | |
genesis_widget_area( 'home-feature-12', array( | |
'before' => '<div class="home-feature-12">', | |
'after' => '</div>', | |
) ); | |
genesis_widget_area( 'home-feature-13', array( | |
'before' => '<div class="home-feature-13">', | |
'after' => '</div>', | |
) ); | |
echo '</div><!-- end .wrap --></div><!-- end #home-feature-bg -->'; | |
} | |
genesis_widget_area( 'home-feature-14', array( | |
'before' => '<div class="home-feature-bg-alt"><div class="wrap"><div class="home-feature-14">', | |
'after' => '</div></div></div>', | |
) ); | |
} | |
genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment