**toocrazy1**

Member

Posted 4 years ago #

Hi there,

I know how to insert adsense after a particular post and it shows up there every time. However, it would be a way better and more effective for my blog if I could insert ads after random post.

Let's say I have 6 posts per every page. I would like adsense to appear after a different post every time visitor goes to another page or refreshes it. It would also work if I could define several values (after 1, 3 and 5 post for example) and adsense would appear in one of these positions randomly.

Is there a way/a code/a plugin to do this? Thank you.

output adsense ad at random position (of a preset range of positions) with in the loop:

http://pastebin.com/2WfX1jQH

**toocrazy1**

Member

Posted 4 years ago #

Thanks, alchymyth, it works!

I would like to improve this a bit. Is there a way to show two or even three ads in random positions after wordpress posts? For exmaple one ad after 1, 3 or 5 post, the other one after 2, 4 or 6 at the same time?

For exmaple one ad after 1, 3 or 5 post, the other one after 2, 4 or 6 at the same time?

basically by doubling the earlier suggested code; for two ads that could be totally different:

http://pastebin.com/qkVL8UJV