-
-
Save billerickson/ab5c2fb4943be8520937b026f73bd2d5 to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* Add CTA Banner | |
* | |
*/ | |
function be_cta_banner() { | |
// Only run on archive pages | |
if( ! ( is_home() || is_archive() ) ) | |
return; | |
// Only insert before first and fifth posts. | |
// Note: Post count starts at 0 | |
global $wp_query; | |
if( in_array( $wp_query->current_post, array( 0, 4 ) ) { | |
echo '<div class="cta-banner"></div>'; | |
} | |
} | |
add_action( 'genesis_before_entry', 'be_cta_banner' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment