Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Add Adsense Between Posts WordPress

  • SOLVED

I have looked through quite a few plugins and all insert adsense within posts or in the widgets.

However, I found a tutorial at -
http://lancesjournal.com/adding-adsense-ads-between-posts/

I tried it, but it did not work correctly.

What I am trying to do is to put the adsense after the 4th post... even if it is an excerpt.

I would love to have this work. No need for any fancy loop. You can base it off of the default WP loop.

I hope this will work. I have been working on this and it would be great.

Thank you ahead of time.

Answers (2)

2010-07-18

Oleg Butuzov answers:

while(have_posts()){
...
...
if (++$POSTSNUMERATOR == 4){
// addsense here
}

}


Nile Flores comments:

Hi Oleg!

could you write this fully out as PHP. I can copy and paste it in quickly so I can try it quickly.

If this works, I will feature you at WPAddict.net as well when I write about WPQuestions.

Thanks for a quick response!


Oleg Butuzov comments:

thanks. Nile can you give me your wp loop (actualy better file where you want to place the code of addsence) via mail?


Nile Flores comments:

I should clarify... is this for the tutorial that was given? Or do I put after the

are the dots means the after the entry, or after the while(have_posts() ) {


Oleg Butuzov comments:

2Valentinas Bakaitis
what for?

wp_debug turned off by default. if it turned on.. well you can check a native db notices wornings, etc....

2Nile

my mail [email protected]


Nile Flores comments:

will send email. You will be awarded this too.


Oleg Butuzov comments:

asap you do that i can help you.

2010-07-18

Valentinas Bakaitis answers:

IMO Oleg's suggestion is exactly what you need. I just would name variable in lower case and set it to 0 before loop.


$postnumerator=0;
while(have_posts()){

...

...

if (++$postnumerator == 4){

// addsense here

}



}