Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created October 15, 2019 13:48
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 billerickson/ab5c2fb4943be8520937b026f73bd2d5 to your computer and use it in GitHub Desktop.
Save billerickson/ab5c2fb4943be8520937b026f73bd2d5 to your computer and use it in GitHub Desktop.
<?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