Skip to content

Instantly share code, notes, and snippets.

@gstricklind
Created February 16, 2016 17:10
Show Gist options
  • Save gstricklind/a018d87397de84efea27 to your computer and use it in GitHub Desktop.
Save gstricklind/a018d87397de84efea27 to your computer and use it in GitHub Desktop.
Code snippets from Genesis Framework presentation at WP meetup
<?
/*========================================================================
Custom CTA
========================================================================*/
// Show CTA above footer widgets
add_action('genesis_before_footer','moons_custom_cta_1', 1);
function moons_custom_cta_1() {
echo '<div class="cta"><div class="wrap">This is the call to action.</div></div>';
}
// Show CTA at bottom of single post but above comments
/*add_action('genesis_after_entry','moons_custom_cta_2', 1);
function moons_custom_cta_2() {
if ( is_single() ) {
echo '<div class="cta"><div class="wrap">This is the call to action.</div></div>';
}
}*/
// Show Cats CTA above footer widgets on Cats category
// Referrence: https://codex.wordpress.org/Conditional_Tags#A_Category_Page
// example url - http://localhost:8888/dev/genesis-framework-prez/category/cats/
/*add_action('genesis_before_footer','moons_custom_cta_3', 1);
function moons_custom_cta_3() {
if ( is_category('category-cats') ) {
echo '<div class="cta"><div class="wrap">Shows on Cats category<br /> <img src="http://i.giphy.com/l0NwN7CLIEBQu0kkU.gif" /></div></div>';
}
}*/
@gstricklind
Copy link
Author

@gstricklind
Copy link
Author

CSS:
.cta { min-height: 200px; text-align: center; padding: 30px 0; background-color: #dfa273; color: #fff; }

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