Skip to content

Instantly share code, notes, and snippets.

@PittsburghChris
Forked from cdils/CTA-Widgets.php
Created November 14, 2013 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PittsburghChris/7468062 to your computer and use it in GitHub Desktop.
Save PittsburghChris/7468062 to your computer and use it in GitHub Desktop.
/**
* 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>',
) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment