• Home
  • Blog
  • Showcase
  • Setup Docs
    • Sunshine Help
    • Flex Help
  • Support
    • Support Area
    • Contact us
    • Feedback
  • Connect
    • Newsletter
    • Twitter
    • Facebook
  • My Account
  • Flex
  • Sunshine
Support : Simple Pro Themes

Support : Simple Pro Themes

Reply To: Ads appear after certain number of posts in blog layout

If you have purchased a product, please enter the email address that you used to register at time of purchase.
Log In
Lost Password

Create an Account
  • Your username must be unique, and cannot be changed later.
  • We use your email address to email you a secure password and verify your account.

Support › Forums › Flex Theme › Ads appear after certain number of posts in blog layout › Reply To: Ads appear after certain number of posts in blog layout

July 16, 2016 at 11:45 am #1111
Chinmoy Paul
Moderator

Try this

add_action( 'genesis_after_entry', 'flex_add_adsense' );
function flex_add_adsense() {
  global $wp_query;
  //* Adding the ads after 3rd post. You can change the value as per your requirement.
  if( $wp_query->current_post == 2 ) {
?>
   <!-- PUT YOUR ADSENSE HTML SCRIPT HERE.-->
<?php
  }

//* Adding the ads after 6th post.
  if( $wp_query->current_post == 5 ) {
?>
   <!-- PUT YOUR ADSENSE HTML SCRIPT HERE.-->
<?php
  }

}

Copyright © 2022 · Simple PRO Themes for Genesis Framework · About · FAQs · Contact · Affiliates