freezeice04
Power Member
- Jul 5, 2010
- 694
- 299
How do I convert all amazon links to the affiliate link version? Is there a plugin to do this automatically?
Nonsense..You have to edit each post manually and generate the affiliate link for each product you are promoting. Then insert them manually.
add_filter('the_content', 'amazon_affiliate');
function amazon_affiliate($url) {
$affiliate_ID = "fashionchicks-20";
$url = preg_replace("/http:\/\/[^>]*?amazon.(.*)\/([^>]*?ASIN|gp\/product|exec\/obidos\/tg\/detail\/-|[^>]*?dp)\/([0-9a-zA-Z]{10})[a-zA-Z0-9#\/\*\-\?\&\%\=\,\._;]*/i","http://www.amazon.$1/dp/$3/?tag=".$affiliate_ID,$url );
return $url;
}