To have
Adsense codes only appear after the first post in Wordpress blog and nowhere else, open the index.php file and search for the following lines:
<!--p if (have_posts()) -->
<!--p $postCount=0;-->
<!--p while (have_posts()) : the_post(); $loopcounter++-->
<!--p $postCount++-->
Add the following above these lines:
<?php
$postnum = 1;
%2tshowadsense1 = 1;
?>
After that search for the following lines in the same index.php file:
<?php if ($loopcounter == 1) { include (TEMPLATEPATH . '/ad_middle.php'); } ?>
</div>
*** Take note about this gap ***
<?php endwhile; ?>
Add the following scripts into the gap:
<?php if ($postnum == $showadsense1) {
echo '
*** Put your Adsense Script here ***
';
} ?>
<?php $postnum++; ?>
By the way, the version of Wordpress tested was Wordpress 2.6.3. Not sure if other version of Wordpress are havi.g the same coding in index.php or not ... Anyway, worth a try.
No comments:
Post a Comment