Title: Special Code Every X Posts
Last modified: April 21, 2017

---

# Special Code Every X Posts

 *  Resolved [bfrye26](https://wordpress.org/support/users/bfrye26/)
 * (@bfrye26)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/special-code-every-x-posts/)
 * Hello,
 * Love the plugin, it is one of the most professional options out there. Right 
   now I am trying to have the template display posts, and every say 5 or so posts
   it displays a script for some advertisement or an “around the web” type box.
 * The only issue is I can for the life of me not get it to work. If we have anything
   in the box with a condition it will just not render anything.
 * I have even tried just adding in code to display text every 5 posts. yet still
   no dice.
 * I welcome your help on the matter.
 * Here is the code right now, and it refuses to render.
 *     ```
       <li<?php if (! has_post_thumbnail() ) { echo ' class="no-img"'; } ?>>
          <?php if ( has_post_thumbnail() ) {
             the_post_thumbnail(array(150,150));
          }?>
          <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
          <p class="entry-meta">
              <?php the_time("F d, Y"); ?>
          </p>
          <?php the_excerpt(); ?>
       </li>
       <?php
         if($alm_current === 6){
          echo "Hello World";
         }
       ?>
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [raven747](https://wordpress.org/support/users/raven747/)
 * (@raven747)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/special-code-every-x-posts/#post-9055026)
 * I am also suffering the same issue. Help would be amazing! I am trying to set
   it up to have an internal AD every 10 posts, but no matter what I add, it will
   not work
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/special-code-every-x-posts/#post-9056178)
 * Hi [@bfrye26](https://wordpress.org/support/users/bfrye26/) & [@raven747](https://wordpress.org/support/users/raven747/),
   
   The only reliable way to do this is with the [Call to Actions](https://connekthq.com/plugins/ajax-load-more/add-ons/call-to-actions/)
   add-on.
 * Hope this helps.
 *  [raven747](https://wordpress.org/support/users/raven747/)
 * (@raven747)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/special-code-every-x-posts/#post-9062124)
 * Wow, thanks for the help! Will pick this up and give it a try!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Special Code Every X Posts’ is closed to new replies.

 * ![](https://ps.w.org/ajax-load-more/assets/icon-256x256.png?rev=2944639)
 * [Ajax Load More – Infinite Scroll, Load More, & Lazy Load](https://wordpress.org/plugins/ajax-load-more/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-load-more/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-load-more/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-load-more/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-load-more/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-load-more/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [raven747](https://wordpress.org/support/users/raven747/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/special-code-every-x-posts/#post-9062124)
 * Status: resolved