| |

Add an “Affiliate Disclaimer” Widget to Your Blog Posts [Kadence]

The FTC has strict guidelines on affiliate marketing. Bloggers and those engaged in professional online affiliate marketing activities such as reviews, ad placements and links included in their content areas, are required to disclose to their visitors that they belong to an affiliate program. Links the visitor may click on could result in the blogger receiving a payment for the click, visit or if a purchase is made from the destination of that link.

 

If you are unfamiliar with working with your theme files, stop and ask for help. If you are familiar with modifying your theme files – you should back them up before proceeding.

Add the Widget Area – Kadence Framework

Locate your functions.php file in your child theme folder via FTP or the File Manager inside your hosting account. Click “View Raw” on the bottom right corner of the code window below. Copy and paste the content to the bottom of the functions.php file. Save it.

 

// Register widget area - Kadence Framework
function register_affiliate_disclaimer_widget() {
register_sidebar( array(
'id' => 'affiliate-disclaimer',
'name' => __( 'Affiliate Disclaimer', 'themename' ),
'description' => __( 'This is the affiliate disclaimer widget area.', 'themename' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'register_affiliate_disclaimer_widget' );
// Hook the widget area into Kadence theme
add_action( 'kadence_single_before_inner_content', 'kadence_affiliate_disclaimer', 15 );
function kadence_affiliate_disclaimer() {
if ( ! is_singular( 'post' ) ) {
return;
}
if ( is_active_sidebar( 'affiliate-disclaimer' ) ) {
echo '<div class="affiliate-disclaimer widget-area"><div class="wrap">';
dynamic_sidebar( 'affiliate-disclaimer' );
echo '</div></div>';
}
}
view raw functions.php hosted with ❤ by GitHub

Add a Little Styling

Next we need to add a little styling. The following code will add a light background color and also some padding so the text is not resting on the edges of the background color. Add this code snippet to the Additional CSS box. Change the background color to your desired color.

/* Update the background color to your designed color */
.affiliate-disclaimer {
background-color: #f9f9f9;
margin-bottom: 35px;
padding: 5px 15px 10px 15px;
}
view raw style.css hosted with ❤ by GitHub

Add Your Widget

Browse over to Appearance > Widgets. You should now see an “Affiliate Disclaimer” widget area. Add a Paragraph Block to that location and enter your disclaimer language. Then save it.

That’s it! Visit your blog posts and it should look like the image above.

Similar Posts