ppspeed on "[Plugin: AddToAny Share Buttons] dynamic link in addtoany shortcode"

ساخت وبلاگ

Hi,

I want to use the addtoany shortcode with a url that changes according to the loged-in/registered user/affiliate. Even though I am not a developer I have created this line of code to achieve that:

<?php echo do_shortcode('[addtoany url="<?php echo $alink_id; ?>" title="Your PP-Speed Affiliate Link for social sharing"]');?>

But it does not work at all. The dynamic url <?php echo $alink_id; ?> is from the same page into which I added this line of code. It comes from the wp affiliates manager plugin. Here is the entire file:

`<div class="aff-wrap">
<?php
include WPAM_BASE_DIRECTORY . "/html/affiliate_cp_nav.php";

$db = new WPAM_Data_DataAccess();
$currentUser = wp_get_current_user();
$alink_id = '';
$affiliateRepos = $db->getAffiliateRepository();
$affiliate = $affiliateRepos->loadBy(array('userId' => $currentUser->ID, 'status' => 'active'));
if ( $affiliate === NULL ) { //affiliate with this WP User ID does not exist

}
else{
$home_url = home_url('/');
$aff_landing_page = get_option(WPAM_PluginConfig::$AffLandingPageURL);
if(isset($aff_landing_page) && !empty($aff_landing_page)){
$home_url = $aff_landing_page;
}
$alink_id = add_query_arg( array( WPAM_PluginConfig::$wpam_id => $affiliate->affiliateId ), $home_url );
}
?>

<div class="wrap">
<?php
if(!empty($alink_id)){
?>
<h3><?php _e('Your Affiliate Link Using Affiliate ID', 'affiliates-manager') ?></h3>
<textarea class="wpam-creative-code" rows="1"><?php echo $alink_id; ?></textarea>
<?php
}
?>
<h3><?php _e('The following creatives are available for publication.', 'affiliates-manager') ?></h3>

<table class="pure-table">
<thead>
<tr>
<th><?php _e('Type', 'affiliates-manager') ?></th>
<th><?php _e('Name', 'affiliates-manager') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->viewData['creatives'] as $creative) { ?>
<tr>
<td class="wpam-creative-type"><?php echo $creative->type ?></td>
<td class="wpam-creative-name">&sub=creatives&action=detail&creativeId=<?php echo $creative->creativeId ?>"><?php echo $creative->name ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<div>
<?php echo do_shortcode('[addtoany url="<?php echo $alink_id; ?>" title="Your PP-Speed Affiliate Link for social sharing"]');?>
</div>
</div>
</div>

Any idea how to get this running? Or a usefull hint where to start searching?

Many, many thanks.

https://wordpress.org/plugins/add-to-any/

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 251 تاريخ : پنجشنبه 3 تير 1395 ساعت: 18:47