Shortcode won’t accept PHP variables. If you have to use PHP code in the shortcode, you can use the shortcode in the PHP template of the desired web page as echo do_shortcode('[TheChamp-Sharing type="vertical" url="'.$referral_url.'"]');
Thread Starter
ramya
(@ramyasam)
yes this code works
but in some social share options, it copies the page link instead of the referral link example copy link, email
You need to check how you are calculating value of $referral_url
Thread Starter
ramya
(@ramyasam)
$user_id = get_current_user_id();
$user = new WP_User($user_id);
$referral_url_by_userid = ‘id’ === $settings[‘referal_link’] ? true : false;
$referral_url = add_query_arg($referral->referral_handel, $user->user_login, wc_get_page_permalink(‘myaccount’));
if ($referral_url_by_userid) {
$referral_url = add_query_arg($referral->referral_handel, $user->ID, wc_get_page_permalink(‘myaccount’));
}