askdesign
10/6/2015 - 10:12 PM

Add Widget Area Below Nav

#cta {
background-color: #222;
color: #fff;
clear: both;
font-size: 20px;
font-size: 1.25rem;
line-height: 1.625;
overflow: hidden;
padding: 64px 0;
padding: 4rem 0;
}

#cta .wrap {
padding: 0 5%;
}

#cta a.cta-button:hover {
color: #222;
}

#cta a:hover {
color: #FFF;
}

/** step 1 - Register widget areas - 4 different CTAs */

genesis_register_sidebar( array(
	'id'				=> 'cta-1',
	'name'			=> __( 'Call to Action #1', 'mp' ),
	'description'	=> __( 'This is the call to action section.', 'mp' ),
) );

genesis_register_sidebar( array(
	'id'				=> 'cta-2',
	'name'			=> __( 'Call to Action #2', 'mp' ),
	'description'	=> __( 'This is the call to action section.', 'mp' ),
) );

genesis_register_sidebar( array(
	'id'				=> 'cta-3',
	'name'			=> __( 'Call to Action #3', 'mp' ),
	'description'	=> __( 'This is the call to action section.', 'mp' ),
) );

genesis_register_sidebar( array(
	'id'				=> 'cta-4',
	'name'			=> __( 'Call to Action #4', 'mp' ),
	'description'	=> __( 'This is the call to action section.', 'mp' ),
) );


/** step 2 - where to put widget areas */
add_action( 'genesis_after_header', 'mp_cta_genesis' );


/** step 3 - when to put the widgets on the page */
/**
 * Add CTA widget support for site. If widget not active, don't display
 *
 */
function mp_cta_genesis() {

  // Don't display the CTA on the home page, since it's built into the MP theme
  if ( is_home() ) {
		return;
	}

  // If it's the About page, display CTA #1
	elseif ( is_page( 'about' ) ) {
		genesis_widget_area( 'cta-1', array(
			'before' => '<div id="cta"><div class="wrap">',
			'after' => '</div></div>',
		) );

	}

  // If it's a page with ID 101 or 102 or any page within my Portfolio CPT
  // Display CTA #2
	elseif ( is_page( array(101,102) ) || ('portfolio' == get_post_type() ) ) {
		genesis_widget_area( 'cta-2', array(
			'before' => '<div id="cta"><div class="wrap">',
			'after' => '</div></div>',
		) );

	}

  // If it's the Contact page, display CTA #3
	elseif ( is_page('contact') ) {
		genesis_widget_area( 'cta-3', array(
			'before' => '<div id="cta"><div class="wrap">',
			'after' => '</div></div>',
		) );

	}
  
  // If all else fails and none of the above conditions are met, display CTA #4
	else {
		genesis_widget_area( 'cta-4', array(
			'before' => '<div id="cta"><div id="enews" class="wrap">',
			'after' => '</div></div>',
		) );

	}

}