Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AffiliateWP Custom Referral URL
<?php
/*
Plugin Name: AffiliateWP Custom Referral URL
Plugin URI: http://affiliatewp.com
Description: Adds AffiliateWP Custom Referral URL
Version: 0.1
License: GPL
Author: AffiliateWP
*/
if ( class_exists( 'Affiliate_WP' ) ) {
if ( ! function_exists( 'affwp_url_referral_var_shortcode' ) ) {
function affwp_url_referral_var_shortcode( $atts, $content = null ) {
$atts = shortcode_atts(
array(
'url' => '',
),
$atts, 'affwp_custom_url' );
return add_query_arg( affiliate_wp()->tracking->get_referral_var(), affwp_get_affiliate_id(), $atts['url'] );
}
add_shortcode( 'affwp_custom_url', 'affwp_url_referral_var_shortcode' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.