I found there was a workaround posted a while ago so whilst it doesn’t answer the URL question it does provide an alternative solution… https://ww.wp.xz.cn/support/topic/text-link-instead-of-button?replies=4 Thank you – this will work for my requirements.
Paul,
If you want the URL wrapped in an anchor tag (<a href=...>[URL]</a>), use the 'link' field instead of the 'URL' field.
[amazon-element asin="XXXXXXXXXX" fields="link"]
That will return the formatted anchor tag that links to product – of course the link text will be the full long URL.
If you need better control over it, you can filter the results somewhat. So let’s say you want to make a read more link – you can do it like this:
function filter_amazon_product_in_a_post_plugin_elements($prodArr = array()){
if(!is_array($prodArr) || empty($prodArr))
return $prodArr;
$prodArrNew = array();
$fieldArr = array('URL');
// First loop is for ASINs (can have up to 10, so need to look in each).
foreach($prodArr as $pkey => $pval):
// Second Loop is for the fields in each ASIN array.
foreach($pval as $key => $val):
if(in_array($key,$fieldArr)):
// If we find the field in our list of fileds to check ($fieldArr), then do something.
$prodArrNew[$pkey][$key] = '<a href="'.$prodArr[$pkey][$key].'" target="_blank"><em>... read more »</em></a>';
else:
// Otherwise, just use original field value.
$prodArrNew[$pkey][$key] = $val;
endif;
endforeach;
endforeach;
return $prodArrNew;
}
add_filter('amazon_product_in_a_post_plugin_elements_filter','filter_amazon_product_in_a_post_plugin_elements', 100, 1);
Hope this helps.
Regards,
Don