In this tutorial, I will show you how to add an Affiliate Disclosure to specific categories of the Refined Theme by Restored 316:
In the Restored 316 Facebook group, a user wanted to know how to add an affiliate disclosure to specific posts, rather than having to manually add the disclosure at the top of every post.
The Problem
The problem with adding in a manual disclosure to each post is that it will display the disclosure as the post excerpt. There are a number of ways of displaying it so that it isn’t included in a post excerpt. You could add it to your post meta, or create a widget to display before posts. But what if you want it to display on specific posts only (say for example Sponsored posts)?
In order to do that, we’ll need to customize the theme to create a new widget which will display above single posts, but only if the posts are assigned to the specific category.
Add Disclosure Widget to Specific Categories: Step One – Create Desired Category
Create a category called “Sponsored”. You can actually give the category any name you want, but if the name is another other than “Sponsored”, you’ll need to adjust the PHP code below:
Add Disclosure Widget to Specific Categories: Step Two – Create New Widget
Navigate to your functions.php file, and add the following:
What this does is create a widget area to display above posts in the “Sponsored” Category.
Once you’ve added this to your functions.php file, you will see a new widget area in your Dashboard.
Add Disclosure Widget to Specific Categories: Step Three- Style CSS:
To make the affiliate disclosure stand out without being obnoxious, add this to your “Additional CSS” (Dashboard > Appearance > Customize > Additional CSS):
Add Disclosure Widget to Specific Categories: Step Four – Add the disclosure
Finally, we’ll add our desired text. Navigate to Dashboard > Appearance > Widgets > Sponsored Posts > drag a text widget to this location, and add your desired text and link to your affiliate disclosure page if desired.
Here is how your disclosure looks on posts using the “Sponsored” category:
If you’re using the Restored 316 Refined Theme, or any other theme built on the Genesis Framework, and are interested in having me implement this for you, send me a note!
Did you know I offer a theme setup service? Get your Restored 316 theme installed and set up like the demo in under 24 hours. Learn more here.
If you liked this tutorial, and would like to thank me by buying me a coffee, you can do so here.
Leave a Reply