Adding Adsense Code to WordPress Thesis Theme

I am experimenting with Thesis, a premium WordPress theme- and really it is more than a theme- its adds incredible functionality to your WordPress site. If you are a beginner it might be overwhelming but if you know coding or can handle modifying your word press theme it is fairly easy to learn.

Now, having said that.. I REALLY struggled getting a very basic task done with Thesis. There is no “single.php” or “index.php” and the css styling is handled a little differently that usual themes. I was pretty surprised on how difficult this was to find out how to do- either there is a way others are doing and I am new and ignorant or my skills are not what I thought they were!
I will cut to the chase and just give you the codes

How to add Adsense Code To Header of Thesis WordPress Theme

By far this was most difficult to solve and took me a good 2 hours to get Adsense code working and the way I wanted it into header of Thesis.

You need to edit custom_functions.php file and custom.css . you will find both in “custom” folder in the Thesis theme directory on your server.
If you haven’t changed name of file folder “custom-sample” in Thesis directory change it now. You need to do this through an ftp client ( like FileZilla )

You can edit the file either directly on the server ( and for the love of god do NOT ignore my BACKUP YOUR FILES warning!! ) or through WordPress interface.

To put Adsense code in the header the way *I* like it is a 728×90 leader board under the title/image/taglines of my blog.
You can use other code- link units or half banners as well.

So… to add Adsense Code to your header in thesis UNDER header here we go:
Create your ad in Adsense. Copy the code it gives you.
Add following to custom_function.php file:

function header_ad() { ?>
<div id="header_ad">
<p>
ADD YOUR ADSENSE CODE HERE
</p>
</div>
<?php }
add_action('thesis_hook_header', 'header_ad');</blockquote>

Next we need to edit the style.css file in “custom” folder.
This code works perfectly for me- centered and aligned perfectly for my site. You may have to change values for yours- its not that hard. Just change numbers and see what it does. If you want to place ad along side of title or title image use “-” sign in front if the first value. try -60 first and go from there.
So, simply copy and paste this code into your style.css sheet:

/* HEADER ADSENSE */
.custom #header_ad {
margin: 10px 0 10px 0px;
}

and that’s it! Hope this saves people the headaches I had doing this :-)

How to Add Adsense Code to Thesis Below Post Title

This was slightly easier and you don’t have to add anything to style.css.
I use either a half banner or link units under the post title.
Create your ad.
Copy the code into custom_funtions.php file where indicated below.

function before_post_ads() {
if (is_single()) { ?>
YOUR ADSENSE CODE HERE
<?php }
}
add_action('thesis_hook_before_post', 'before_post_ads');

Add Adsense Code To End of Post in Thesis WordPress Theme

function after_post_ads() {
if (is_single()) { ?>
Your Ad Code Here !
}

add_action(‘thesis_hook_after_post’, ‘after_post_ads’);

Read Other Related Blogging and Web Marketing Posts

    Best WordPress Themes to Use for Google Adsense
      Here’s a Weird One- “The requested theme does not exist” when in Theme Editor
        Trouble adding MyBlogLog Plugin to WordPress
          How to Add NOFOLLOW Tags to Your Paid Links
            Using Aggressive Google Adsense Ads for Higher CTR – Embedding Your Google Adsense Ads into Posts

            3 Responses to “Adding Adsense Code to WordPress Thesis Theme”

            1. Features fast paced games on a realistic vegas style environment for your enjoyment

            2. sign up offers available today on the Internet.

            3. Great info. i use Thesis on one of my blogs and it’s good to know how to do a little coding to get things done.

            Discussion Area - Leave a Comment




            dofollow directory logo