Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active April 20, 2016 14:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save billerickson/2e4e9a26573378a15943 to your computer and use it in GitHub Desktop.
Save billerickson/2e4e9a26573378a15943 to your computer and use it in GitHub Desktop.
<?php
/**
* EA Genesis Child.
*
* @package EAGenesisChild
* @since 1.0.0
* @copyright Copyright (c) 2014, Contributors to EA Genesis Child project
* @license GPL-2.0+
*/
/**
* Home Rotator
*
*/
function be_home_rotator() {
$slides = get_post_meta( get_the_ID(), 'be_slide', true );
if( $slides ) {
echo '<div class="home-rotator"><div class="wrap"><div class="flexslider"><ul class="slides">';
for( $i = 0; $i < $slides; $i++ ) {
$image = wp_get_attachment_image( get_post_meta( get_the_ID(), 'be_slide_' . $i . '_image', true ), 'be_slide' );
$title = esc_attr( get_post_meta( get_the_ID(), 'be_slide_' . $i . '_title', true ) );
$button_link = esc_url( get_post_meta( get_the_ID(), 'be_slide_' . $i . '_button_link', true ) );
if( $title ) {
if( $button_link )
$title = '<a href="' . $button_link . '">' . $title . '</a>';
$title = '<h2>' . $title . '</h2>';
}
$content = get_post_meta( get_the_ID(), 'be_slide_' . $i . '_content', true );
$button_text = esc_attr( get_post_meta( get_the_ID(), 'be_slide_' . $i . '_button_text', true ) );
$button = $button_text && $button_link ? '<p><a href="' . $button_link . '" class="button">' . $button_text . '</a></p>' : '';
$bg = get_post_meta( get_the_ID(), 'be_slide_' . $i . '_bg', true );
$class = $bg ? 'slide-caption white-bg' : 'slide-caption';
echo '<li>' . $image . '<span class="caption-wrapper"><span class="' . $class . '">' . $title . wpautop( $content ) . $button . '</span></span></li>';
}
echo '</ul></div></div></div>';
}
}
add_action( 'be_content_area', 'be_home_rotator' );
// Remove 'site-inner' from structural wrap
add_theme_support( 'genesis-structural-wraps', array( 'header', 'footer-widgets', 'footer' ) );
/**
* Add attributes for site-inner element, since we're removing 'content'.
*
* @param array $attributes Existing attributes.
* @return array Amended attributes.
*/
function be_site_inner_attr( $attributes ) {
// Add a class of 'full' for styling this .site-inner differently
$attributes['class'] .= ' full';
// Add the attributes from .entry, since this replaces the main entry
$attributes = wp_parse_args( $attributes, genesis_attributes_entry( array() ) );
return $attributes;
}
add_filter( 'genesis_attr_site-inner', 'be_site_inner_attr' );
// Build the page
get_header();
do_action( 'be_content_area' );
get_footer();
@jb510
Copy link

jb510 commented Oct 6, 2014

Missing comma between 'footer-widgets' and 'footer'
add_theme_support( 'genesis-structural-wraps', array( 'header', 'footer-widgets', 'footer' ) );

@territutich
Copy link

just wanted to say thanks for this. Didn't think about putting add_theme_support call on a template - totally the idea I was looking for. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment