Archive

Posts Tagged ‘google ads’

Strategically inserting Google ads into Wordpress blog

May 21st, 2009

Have been working hard to promote blog.52my.info, but have realized that there isn’t an easy way to add google ads more naturally in between posts.  Some research landed me on Problogger.net (an excellent blog that teaches/motivates people how to make money blogging — I am a believer in Darren).

To more naturally add google ads, what you simply need to do is modify your “Main Index Template” usually the index.php file.  In there you should find a while loop that looks something like:

if (have_posts()) :
while (have_posts()) :
the_post();
the_content();
endwhile;
endif;

just change it to something like this:

// Set Counter to 1, First Post
$counter = 1;
if (have_posts()) :
   while (have_posts()) :
      $counter = $counter + 1;
      the_post();
      the_content();
      if(2 == $counter)
      {
         echo 'Adsense code';
      }
   endwhile;
endif;

the things to look for and add are in bold.  The “2″ indicates that google ads will be inserted in every 2 posts. This information was obtained here

blog posting, technical notes, wordpress , ,