Tips to add Google Adsense to WordPress
Today, I will share with you some useful tips to add Google Adsense to WordPress. With these tips, you can add Google Adsense to WordPress at any where you want. Just follow these tips.
1. If you want to place Google Adsense at the top of the whole page, open your theme header.php file and place your Adsense code right after the <body> tag.
2. If you want the ad at the bottom of your posts, open your theme file index.php and place your Adsense code before the lineĀ <?php get_sidebar(); ?>
3. If you wanted the ad to only appear under the first post and nowhere else, open your theme index.php file and find these lines:
Paste the following codes above those lines.
<?php
$postnum = 1;
$showadsense1 = 1;
?>
Then scroll down to this part:
<?php wpe_excerpt(‘wpe_excerptlength_index’, ”); ?>
<a class=”readmore” href=”<?php the_permalink() ?>”>Continue</a>
</div>
</div>
Paste these codes below.
<?php if ($postnum == $showadsense1) {
echo ‘
Place Google Adsense code here
‘;
} ?>
<?php $postnum++; ?>
Now you can put the Google Adsense ads where you want.
Category: WordPress, WordPress tips


























Thank you for posting this.