Last active
February 16, 2021 17:10
-
-
Save ramiabraham/8351ca84f2fd9eb9c27d to your computer and use it in GitHub Desktop.
AffiliateWP Custom Referral URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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