Created
December 17, 2013 21:21
-
-
Save derekperkins/8012804 to your computer and use it in GitHub Desktop.
Ackermania Homepage
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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment