title: inserting ads after every 7th post in wordpress home page
body: <p>I am trying to place google ads between every 7 posts in my homepage and category pages of wordpress site.</p>
  
  <p>i have found this code on WordPress forum and tried myself by putting it it didn't worked. i am not sure how to use this code in my theme.
  the code i found is this.</p>
  
  <pre><code>if ( have_posts() ) : $count = 0; while ( have_posts() ) : the_post();
  //before 
  if (($count&gt;1) &amp;&amp; ($count%5 == 0) ){ ?&gt;
    &lt;div&gt;
      [adcode] 
    &lt;/div&gt; &lt;?
            } $count++;
  </code></pre>
  
  <p>here is the relative code from index.php of my theme.</p>
  
  <pre><code>if(have_posts()) : while(have_posts()) : the_post(); ?&gt;
  
                  &lt;?php 
  
                  if ( floatval(get_bloginfo('version')) &lt; "3.6" ) {
                      //old post formats before they got built into the core
                       get_template_part( 'includes/post-templates-pre-3-6/entry', get_post_format() ); 
                  } else {
                      //WP 3.6+ post formats
                       get_template_part( 'includes/post-templates/entry', get_post_format() ); 
                  } ?&gt;
  
              &lt;?php endwhile; endif; ?&gt;
  </code></pre>
  
  <p>i want to know how do i place the code according to my the upper code of index.php. thanks</p>