Posted By

udin on 06/02/13


Tagged


Versions (?)

amaibe


 / Published in: PHP
 

ama to ibe

  1. function amaToEbay($content){
  2. global $post;
  3. $content = do_shortcode($content);
  4. $query = get_the_title($post->ID);
  5. if (str_word_count($query) >= 3){
  6. $query = explode(' ',$query,3);
  7. array_pop($query);
  8. $query = implode(' ' , $query);
  9. }
  10. $content = preg_replace('#<a[^>]*href="http://(www\.)?(?=amazon|redirect)[^>]*>(.*?)</a>#', '<a target="_blank" rel="nofollow" href="http://www.ebay.de/sch/i.html?_nkw='. urlencode($query) .'">$2</a>',$content);
  11. return $content;
  12. }
  13. add_filter('the_content','amaToEbay');

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: udin on June 2, 2013

diedit biar bisa replace link yg langsung ke amazon atau pakai redirect

You need to login to post a comment.