Affiliate Info Installation and Usage

How to Install and Use the Affiliate Info Add-on for AffiliateWP

Affiliate Info allows you to show affiliate information based on the affiliate currently being tracked.

In this article, we’ll show you how to install and set up the Affiliate Info add-on for AffiliateWP.

  1. Installing the Affiliate Info Add-on
  2. Using Affiliate Info Shortcodes
  3. Affiliate Info PHP Functions

1. Installing the Affiliate Info Add-on

Before we get started, be sure to install and activate AffiliateWP on your WordPress site.

Once you’ve got AffiliateWP installed and your license is verified, you’ll be able to quickly install and activate the Affiliate Info add-on.

After installing the Affiliate Info add-on, the next step is to display Affiliate information throughout your site.

2. Affiliate Info Shortcodes

[affiliate_info_name]
Shows the affiliate’s display name

[affiliate_info_website]
Show the affiliate’s website URL

[affiliate_info_email]
Show the affiliate’s email address

[affiliate_info_gravatar]
Show the affiliate’s gravatar image

[affiliate_info_username]
Show the affiliate’s WordPress username

[affiliate_info_bio]
Show the affiliate’s biographical info (from their WordPress profile)

[affiliate_info_twitter]
Show the affiliate’s Twitter username. This field is shown on a user’s WordPress profile page when the  Yoast SEO plugin is installed.

[affiliate_info_facebook]
Show the affiliate’s Facebook URL. This field is shown on a user’s WordPress profile page when the  Yoast SEO plugin is installed.

[affiliate_info_googleplus]
Show the affiliate’s Google+ URL. This field is shown on a user’s WordPress profile page when the  Yoast SEO plugin is installed.

[ affiliate_info_referred ]
Show content only when an affiliate is being tracked.
Example:
[ affiliate_info_referred ] Your site representative is [ affiliate_info_name ]
[ /affiliate_info_referred ]

[affiliate_info_not_referred]
Show content only when an affiliate is not being tracked. Useful for providing a fallback.

3. Affiliate Info PHP Functions

<?php

$info       = affiliatewp_affiliate_info()->functions;

$name       = $info->get_affiliate_name();
$email      = $info->get_affiliate_email();
$website    = $info->get_affiliate_website();
$bio        = $info->get_affiliate_bio();
$gravatar   = $info->get_affiliate_gravatar();
$twitter    = $info->get_twitter_username();
$facebook   = $info->get_facebook_url();
$googleplus = $info->get_googleplus_url();
$username   = $info->get_affiliate_username();

// Example: Show the affiliate's name
echo $name;

// Example: Only show a banner if an affiliate referred the user
if ( affiliatewp_affiliate_info()->functions->get_affiliate_id() ) {
  echo 'Your site representative is ' . $name;