Tutorial: Place AdSense in WordPress Post Template
This is for those running a WordPress.org blog who would like to add AdSense to their template. The main benifit to adding it to a template is you will no longer have to manually edit your post.
I’m assuming you already have:
- A working WordPress.org web blog.
- The AdSense Manager Plugin uploaded and enabled.
- An AdSense Account through google.com.
For those of you familiar with the AdSense Manager Plugin, you may have noticed in the instructions that you can place your ads in a template so that you don’t have to manually enter them each time you make a post. The instructions explain that you may place this piece of code into a template:
<?php adsensem_ad('name'); ?> or <?php adsensem_ad(); ?>
However, it doesn’t explain exactly where to place it. Well, it’s pretty easy.
1.) In the WordPress.org administration panel, click on “Presentation” and then “Theme Editor“.
2.) In the “Theme Files” column, click on “Single Post“.
3.) Within the code on the left column, search for <div class=”entry”>
4.) Place the code (replacing the word “name” with the name of your ad) somewhere within that div class. For example, mine looks like this:
<div class="entry">
<?php adsensem_ad('inside_bluesky'); ?>
<?php the_content(__('Continue Reading ยป')); ?>
<?php wp_link_pages(); ?>
<p class="post-tags">
<?php if (function_exists('the_tags')) the_tags('Tags: ', ', ', '
'); ?>
</p>
</div>
That should be everything. I’ve shown you how to integrate AdSense into a WordPress template. If you’d like, you can get more creative and place the same code in other areas of your template.
Good luck!
Feel free to
buy me a soda if this post prevented any headaches! Another way to show your appreciation is to take a gander at these relative ads that I hope you'll be interested in:
Here are some similar posts that you may be interested in:
- Search Craigslist.org Quickly Using Boolean Logic [Craigslist Tip]
- Adding Hard Word Wrap/Line Break Feature to Gedit [Tutorial]
- Quickly Search the Terminal History in Unix Using Ctrl+R
- LaTeX Laboratory Report Template with Many Examples
- Example of Search and Replace New Line/Special Characters in vi

thanks derek.. your tips are very usefull for me.. :)
No problem! Glad I could help in any way.