Thesis Tutorial: Automatically Add Affiliate Banner After Blog Post Content

This Thesis Tutorial shows you how to add an affiliate banner or advertisement at the end of every blog post that is on a page all by itself (a single post per page).   Typically, you see blog posts on the home page or on the blog page and you are looking at the “blog loop” which are a string of the latest blog posts.   You will NOT see see the affiliate advertisement or banner at the end of the content of these posts that are on the front page.

Single Post per Page

You will only see the affiliate banners and advertisements if you click on the blog post so that you end up with just that ONE BLOG POST on ONE PAGE.  That is what I am showing you how to do in this video and with the PHP code that I have included in this blog post.   If you would like to find the PHP code to add the affiliate banner at the end of the content of a blog post on the home page or at the end of WordPress blog Pages NOT just WordPress blog Posts, then you should click on this link to the DIYThemes.com website which is where I got to code I used in this video.

Backup the custom_functions.php file

Before you paste the following code into the custom_functions.php file, you MUST backup your custom_functions.php or it could end up being a very bad day for you.  If you leave out one little semi-colon (;) or character in the code,  you may lose access to your site.  With a backup and an FTP connection, you are back in business in minutes. Without a backup, your nightmare has just begun.

Click here for my Thesis Theme Video Tutorial on How to Backup the custom_functions.php file.

Code for the custom_functions.php file

Ok, now below is the code I use in the video which you are required to paste into the custom_functions.php file.

/* START of Affiliate Link After Post */

function single_post_ads() {

if (is_single()) { ?>

// INSERT Affiliate Link Code Here

<?php }

}

add_action('thesis_hook_after_post', 'single_post_ads');

/* END of Affiliate Link After Post */

And here’s the video showing you how to do it:

Meet the Author

Jupiterjim
16 comments… add one
  • vance Jun 4, 2012, 8:03 pm

    I like online tutorials especially when they’re free. Thanks for sharing this post. I know you’re able to help other people as well (like me!) who aren’t really that tech-savvy.

  • Franc Ramon Jun 4, 2012, 8:48 pm

    Interesting. I’ll be visiting your site to avail of the free tutorials.

  • ia adam-lim Jun 4, 2012, 8:57 pm

    Cool! I can make my own banner and add it. Another post to bookmark!

  • Dioce Tabirak Jun 5, 2012, 12:41 am

    Nice… I can use it in our own Thesis. Thanks guys.

  • Joy Felizardo Jun 5, 2012, 1:13 am

    COOL! I’ve been actually looking for sites on this. Thanks for sharing this to us!

  • rain Jun 5, 2012, 12:20 pm

    I am a little off when it comes to technical stuff… that’s why this site is really a great help for people like me.. thanks for sharing.

  • Pete Jun 5, 2012, 2:02 pm

    Thank you for the comprehensive tutorial. I personally believe in showing results, and using pictures to help tell the story as much as possible.

    Great post!

    • jupiterjim Jun 10, 2012, 1:06 pm

      Pete,

      Glad you like. Thanks for the comment!

  • Blair Villanueva Jun 6, 2012, 8:17 pm

    thanks for this post, I’ve learn additional infos.

  • Herbert Jun 7, 2012, 8:23 am

    Love this one Jim.. I will try implementing this on my new blog

  • Harry Sehgal Jun 9, 2012, 6:53 am

    I was looking to add some banners of my Affiliate Products after every single post or after 2 posts or so. This post is good, I dont have knowledge of php, but I will follow your post and add the banner after every post.

  • Frances Jun 11, 2012, 11:15 am

    Nice job Jim! This video tutorial is a great help in adding affiliate banner. This can be a very useful application in a blog post.
    Thanks for sharing it!

  • Shelley Alexander Jun 12, 2012, 8:47 pm

    Thanks Jim for the comprehensive video tutorial for adding affliate banners. I have 6 affliates and this video will be a great help to me. I appreciate you always sharing such useful information!

    • jupiterjim Jun 19, 2012, 4:46 am

      Shelley,

      Glad you found it helpful!

  • Ian Eberle Sep 11, 2012, 1:37 am

    I am currently converting my blog from a standard WordPress theme to the Ultimatum framework and wondered if this tutorial was specific to just Thesis or would it work with any WordPress theme?

  • Maddy Aug 16, 2013, 1:38 pm

    I think the thesis hooks can do it easily. I have used it many times and all of the ads in articles, header and sidebars by the use of Thesis hooks or Wordpress hooks.

Leave a Comment