Automatically replace words by affiliate links
11 Mai 2013, Posted by inTo replace words by affiliate links automatically, simply paste the code below into your functions.php file. Remember to enter your words/links as shown in the example code below.
function replace_text_wps($text){ $replace = array( // 'WORD TO REPLACE' => 'REPLACE WORD WITH THIS' 'thesis' => '<a href="http://mysite.com/myafflink">thesis</a>', 'studiopress' => '<a href="http://mysite.com/myafflink">studiopress</a>' ); $text = str_replace(array_keys($replace), $replace, $text); return $text; } add_filter('the_content', 'replace_text_wps'); add_filter('the_excerpt', 'replace_text_wps');