Skip to content

Instantly share code, notes, and snippets.

@ramiabraham
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save ramiabraham/64c6aa8992954f4bc36f to your computer and use it in GitHub Desktop.

Select an option

Save ramiabraham/64c6aa8992954f4bc36f to your computer and use it in GitHub Desktop.
Affiliate ID shortcode
<?php
/*
Plugin Name: AffiliateWP Affiliate ID Shortcode
Plugin URI: http://affiliatewp.com
Description: Adds a shortcode that displays the AffiliateWP affiliate id.
Version: 0.1
Author: AffiliateWP
Author URI: http://affiliatewp.com
*/
if ( class_exists( 'Affiliate_WP' ) ) {
if ( ! function_exists('affwp_affiliate_id_shortcode') ) {
function affwp_affiliate_id_shortcode() {
if ( affwp_is_affiliate() ) {
echo affwp_get_affiliate_id();
} else {
echo 'This account is not yet an affiliate on this site.';
}
}
add_shortcode( 'affiliate_id' , 'affwp_affiliate_id_shortcode' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment