Add Adsense To The Thesis WordPress Theme

Recently, a customer asked me to add Adsense to their Thesis WordPress Theme, which I had recommended to him.

I recommend the Thesis theme to all of those who want a great theme that is extensible and extremely readable.  The Thesis Theme truly presents content beautifully.

So, when this customer asked me to add Adsense to the Thesis Theme, I said, “Sure, no problem, it will just take a sec.”

If you are WordPress aware, you then know how this process usually goes.  You simply find the single.php file and add the Adsense code where you would like Adsense to appear, which in this case was directly under the title.

However, with Thesis, it’s a little different.  When you search for the single.php file, it’s not there!

Thesis is structured differently from all other WordPress Themes and it uses hooks.   All of the action takes place in a file called custom_functions.php.

To add adsense to the Thesis Theme under the article title and just above the post content, you need to add the following code to your custom_functions.php file.  The first two lines should be placed within the php codes symbols which begin with <?p…

function add_adsense() {
if (is_single()) {

After these lines, allow the php to close, which would look like ?>.

Now, you can paste the adsense script that you have been given from Google.

After you add the adsense code, you will then reopen the php code, add a couple of closing brackets (necessary from the two lines above) and then add this line:

add_action(‘thesis_hook_before_content’, ‘add_adsense’);

As you can probably see, this adds your adsense syntax before the post content, which is a great place to put it if you want the maximum amount of clicks.

Why is the Thesis Theme Designed This Way

DIY designed the Thesis Theme to be easier to use with this notion of “hooks”. The thinking was that people would no longer have to mess with the single.php, index.php, and .css files with the theme.

For people like me, who are accustomed to messing with these files, the Thesis Theme is a big departure. Even people like Rae Hoffman, who knows WordPress inside and out, were initially thwarted by the paradigm shift. Initially, she said of the Thesis Theme:

It looked completely awesome until I downloaded it and saw that Thesis was now run completely on “hooks”. Not only did I not know what a hook was, the tutorials and discussions I saw about it scared the hell out of me.

Great Thesis Theme Tutorial

What did Rae do after her initial fear of hooks? She did what enterprising people do…set about learning Thesis and presenting her knowledge in a Thesis Tutorial – Hooks for Dummies series which will find quite useful.

I used these tutorials as the basis for this article on How to Add Adsense to the Thesis WordPress Theme.  Now, after writing the article WordPress Category Pages: The Most Overlooked SEO Gem this morning, I realize that I need to figure out how to customize WordPress Categories with the Thesis Theme. And, fortunately, in her dummies Tutorial, Rae has just written the Thesis Tutorial – Creating Custom Categories.

For more Thesis learning information, you may also want to check out this page from bloghighlight.com.

Add Adsense to Thesis Theme: Summary

Thesis is a great theme that takes some getting used to. Even with the great tutorials available, it took me a little time to add Adsense to the Thesis Theme because I did not find an article on doing exactly that.

I hope this article has taught you how to add Adsense and led you to other sites that will allow you to learn the Thesis Theme inside and out.

Other Thesis Theme Resources

From the source, DIY Themes, check out the Thesis Theme User’s Guide.
Check out the Thesis Theme Headquarters website, a site dedicated to Thesis.

Richard CummingsAdd Adsense To The Thesis WordPress Theme

Comments 8

  1. Pingback: 250+ Thesis Theme Resources | Sahil Kotak dot Com

  2. Thesis Theme Design

    It is a great article on how to add the Google adsense code into a thesis theme. But i would like to suggest you to accumulate all of the codes in a single para with a example of adsense code; so that the general peoples would understand it easily.

  3. James

    the tutorial is great.. but i suggest to elaborate more on how to add the adsense code..which part.. specific.. although I managed to do it..

  4. Pingback: The Huge Thesis Compilation| Skins , Resources , Tutorials

  5. Sergio Felix

    Hello Richard,

    I just stumbled into your site trying to find out how great Thesis is for an Adsense based site?

    I don’t know anything about Adsense, so far I have researched that other themes have better CTR but Thesis has very powerful features for ranking up really high.

    So any thoughts?

    Thanks in advance!
    Sergio

Leave a Reply

Your email address will not be published. Required fields are marked *