Skip to content

Instantly share code, notes, and snippets.

@jasontucker
Last active September 26, 2017 00:16
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 jasontucker/28bac4195d3e682770673a55df5787f2 to your computer and use it in GitHub Desktop.
Save jasontucker/28bac4195d3e682770673a55df5787f2 to your computer and use it in GitHub Desktop.
add_action( 'fl_builder_post_grid_after_column', 'probb_add_google_adsense', 10, 2 );
function probb_add_google_adsense( $settings, $module ){
//if( is_home() || is_front_page() ){
//if( 'columns' !== $settings->layout && 'main_query' !== $settings->data_source){
if( 'columns' !== $settings->layout ){
// If we're using the column layout or not
return;
}
if( FLBuilderLoop::$loop_counter == (FLBuilderLoop::$loop_counter % $settings->post_columns == 0)){
// finding the mod using the number of columns
// and how many times the $loop_counter is running.
// This way after each row we'll display the adblock
?>
<div class="fl-clear"></div>
<div class="full-width row">
<div class="add-wrap">
<?php the_ad(5052); ?>
</div>
</div>
<div class="fl-clear"></div>
<?php
}
//if ( isset( $settings->data_source ) && 'custom_query' == $settings->data_source )
FLBuilderLoop::$loop_counter += 1;
//increment the loop counter
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment