Similar to what's here and many other places on stackoverflow, but with a twist.
Say I have the sentence "I like brown dogs." on my page. I want to process this text before it's output and look for the word brown. If brown is already part of a link (wrapped in an A tag) then do nothing. However if it is not in a link, use my pre-defined code as a replacement.
My code would be something like this:
<a href="/brown" title="Looking for the color brown?">brown</a>
It would be best if the original case of the word didn't change either.
I'd like this to be an array I can specify, such as:
$links = array("brown" => array("/brown" => "Looking for the color brown?"));
I don't even know if I explained well enough, or if it's possible, but if it is, please let me know. Thanks!
Edit: I found one close to what I want, and got it to work somewhat. Find the code here. The problem is I can't limit the number of replacements, such as only do it once per page, or twice per page. Ideally I'd like to tell it to ignore it if it's in H tags. Hi milki_.