Title: how show adsense.php randomly
Last modified: August 20, 2016

---

# how show adsense.php randomly

 *  [hamoon64](https://wordpress.org/support/users/hamoon64/)
 * (@hamoon64)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/how-show-adsensephp-randomly/)
 * hi.i use these codes for showing static ads in my website between posts.
 * <?php $count=count+1; ?>
 * <?php
    $postnum = 1; $showadsense1 = 2; $showadsense2 = 4; $showadsense3 = 4;?
   > <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); $loopcounter
   ++; ?>
 * <?php if ($postnum == $showadsense1) { include (TEMPLATEPATH . ‘/adsense1.php’);}?
   >
    <?php if ($postnum == $showadsense2) { include (TEMPLATEPATH . ‘/adsense2.
   php’); } ?> <?php if ($postnum == $showadsense3) { include (TEMPLATEPATH . ‘/
   adsense3.php’); } ?> <?php $postnum++; ?> <?php if ($loopcounter <= 0) { include(
   TEMPLATEPATH . ‘/adsense3.php’); } ?> <?php endwhile; ?> <?php else : ?> <?php
   endif; ?>
 * but i want use them randomly. for example one time show adsense1.php between 
   1-2 posts and another time show adsense2.php beteen them.
    tnx

The topic ‘how show adsense.php randomly’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [hamoon64](https://wordpress.org/support/users/hamoon64/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/how-show-adsensephp-randomly/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
