Dynamic links
-
I’m trying to set my funnel up to allow anyone to use an ID in the URL to get credit for a referral.
Instead of me sending them to mysite.com, I would send them to mysite.com/?id=MyID.
When they click the button to join the opportunity I’m promoting, I want it to take them to opportunitysite.com/MyID.
As an incentive for them to sign up, I’ll provide my funnel for them to use to promote the same opportunity, but without building them another funnel.
So they can send their leads to mysite.com/?id=TheirID. When their lead clicks the button to join the opportunity, it takes them to opportunitysite.com/TheirID.
I tried the following code to functions.php, but it broke my page. I think this is a step in the right direction. Can anyone help me out? And where at in functions.php would be better to put it?
function themeslug_query_vars( $qvars ) { // add 'id' to the recognised query string vars $qvars[] = return $qvars; } add_filter( 'query_vars', 'themeslug_query_vars' ); function themeslug_init() { // get the ID $aff_id = get_query_var('id'); // if present, do the redirect if isset( $aff_id ) { // redirect header("HTTP/1.1 301 Moved Permanently"); header("Location: https://www.opportunitysite.com/" . $aff_id); } } add_action('init', 'themeslug_init’);
The page I need help with: [log in to see the link]
- The topic ‘Dynamic links’ is closed to new replies.