Skip to content

Instantly share code, notes, and snippets.

@ramiabraham
Last active February 16, 2021 17:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramiabraham/8351ca84f2fd9eb9c27d to your computer and use it in GitHub Desktop.
Save ramiabraham/8351ca84f2fd9eb9c27d to your computer and use it in GitHub Desktop.
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