Adding AdSense Code Into A WordPress Theme
Adding or embedding AdSense ads or any type of script or code into a WordPress blog is pretty easy once you understand where to place it. In order to do that you first need to know what some of the code in your WordPress theme means. This WordPress Guide will show you what some of the themes code means and where you can embed scripts like AdSense, HTML code or even images.
In order to edit your theme from within the WordPress dashboard your themes files must writable. Do do that you need to change the permissions, or CHMOD of the themes files to at least 666 or 777. You could also work on them in the hosting accounts file manager or on your computer and FTP upload the changes files. I prefer to edit the theme from the dashboard.
Before you get started you should copy any file you are attempting to edit and save it in a text file on your computer. If anything goes wrong you can simply paste the unedited version back to undo any damage. You have been warned!
Starting from the top of the WordPress blogs main page, just above the post you can place your AdSense script like shown on this blog, a graphic, banner ad, both AdSense and a banner like shown on my other Work At Home Business Blog, or anything else for that matter. Keep in mind that Google will usually only show three AdSense blocks per page, so if you place AdSense into your WordPress theme and also in your posts and then in the sidebar, usually only the top three blocks will show. The remainder will be open space.
The place to add your code is in the main index template (index.php) and if desired can also be placed in the single post (single.php), page template (page.php), archives and if your theme has one the 404 template. Open one of the files and place your code just above the content which is code that looks like this:
Your Code Here
<?php if (have_posts()) : //Are there any posts? ?>
Other places to place the code are:
Below the post above or below the comments would be:
<?php if ( comments_open() ) : //if comments are allowed ?>
You can experiment with many different places, just be sure to backup any file you are attempting to edit, and that the AdSense code or banner fits in the area and that all HTML or script tags are properly closed. It would also be wise to view your changes in different browsers and different size windows to make sure it looks right.
For AdSense within a post I use and recommend the AdSense Deluxe plugin, check out the guide for it here: How To Use The WordPress Plugin AdSense-Deluxe.
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Tagged with WordPress Guide
Related Posts
One Response to “Adding AdSense Code Into A WordPress Theme”
Discussion Area - Leave a Comment
If you have a question about your blog please leave a link to it. Please don't ask questions like "Why don't my blog work right?" and expect an answer.Two links or less are welcome, any more and your comment will be spammed! Nofollow has been disabled, all comments are moderated and will not appear until approved. Please submit only once.
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Or just copy the example below and change your details.
Example - <a href="http://www.YourSite.com">Title Of Site</a>










TQ for your nice info. Good Luck ?