• Hello,

    I am trying to use php to allow for a link from specific word to a specific site every time that word appears.

    This is what I have tried:

    function wpToLink($content){
    $content = str_ireplace(“doctor”,’Doctor‘, $content);
    return $content;
    }
    add_filter(‘the_content’,’wpToLink’);

    It worked for my professor but not for me. The word is highlighted but the cursor will not allow me to click on it to be sent to the site.

    Please help,
    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter tardisgrl

    (@tardisgrl)

    It appears the replacement has worked but not the link…

    You need to be more careful when you quote code, and read what your own post looks like, I am sure that the snippet above is not what you intended, this may also reflect upon the problem you are having.

    Where did you put this code ? In functions.php of your theme would work, elsewhere ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Linking words to sites’ is closed to new replies.