Automatically Add Affiliate Disclosure to the Top of All Posts

Actually, this post doesn’t include affiliate links, but you’re probably seeing a disclaimer that it does – because I’ve enabled that for this post just to show what it looks like!

If you read my recent article on the FTC’s Endorsement Guidelines for bloggers, you may also be wondering how to automatically insert a disclosure at the top of your posts. Using Genesis, there are two simple ways to do just that.

Using functions.php

The first is my preferred method, but it involves editing your theme’s functions.php file. Which requires FTP. Which requires an FTP program. Which requires a little more effort than we want to put in, sometimes. 🙂

If you’re up for it, here’s what you want to put into that file:

This code lets you insert the disclosure statement at the top of your post, under your title but above your social share buttons and post.

Using Genesis Simple Hooks

The second is a little easier for the average user, and it works basically the same way. You’ll notice that it’s using a portion of the same code, even. In fact, the only thing we need to change is the “hook.”

See ‘genesis_entry_content’ in the last snippet? That’s where we’re inserting the code. The 1 at the end is the priority, which sort of says “where,” within the other items attached to the same hook, our code should be inserted. With Genesis Simple Hooks, we don’t have the ability to add a priority, so we’ll use a different hook: ‘genesis_before_entry_content.’

Make sure you check the box to “Execute PHP on this hook?”

Our disclosure will still show below the post title and above the social share buttons and content.

How can I put my disclaimer below my social share buttons and above my content using Genesis Simple Hooks?

Your share buttons are usually being added into the post content, while Genesis hooks are only available above or below the content, not within it. Luckily, that doesn’t mean it can’t be done. It just means we have to be a little cleverer. 😉

Almost all social share plugins allow you to disable their automatic insertion in favor of a shortcode. By including that in our code, we can manually put it above the disclosure – just where we want it! (BTW, this code includes the shortcode for Simple Share Buttons Plus, you’ll want to change that out for whatever shortcode your plugin uses.)

Don’t forget to enable both “Execute PHP on this hook?” and “Execute Shortcodes on this hook?”

This time, you’re going to see our disclosure below the post title and social share buttons and above the content!

Leave a comment if this was helpful or you’re modifying this solution!

Did you know we can even limit this so that it only shows on posts with a certain category or tag? Yeah, it’s pretty awesome what we can do and how easily we can change that out in the future!