• Hello,
    I am rather new to WordPress. I am trying to figure out how to transform a custom tag into an anchor tag. I’ve created a special tag to markup my posts that I would like converted into a link to the proper page when viewed.
    My tag takes the form of: <def Id=”itemid”>linkname</def>. I want it converted when the page is displayed to: linkname.
    I tried doing a ‘str_replace()’ on the ‘the_content()’ function, but that didn’t seem to work. Is there an easier way to do this? Otherwise, in what file is ‘the_content()’ located? (I would prefer to do this in the template as opposed to editing that function.)
    Thank you in advance for any tips.

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

    (@duck1123)

    I’d just like to say, I found where ‘the_content()’ is located and made the required changes. (it’s “wp-includes/template-functions-post.php” if anyone is wondering.) It is now working properly.
    I’m still open to suggestions on how to better do this, but it’ll work for now.

    Thread Starter duck1123

    (@duck1123)

    Thank you very much for that tip. That was exactly the reason I didn’t want to have to edit ‘the_content()’ directly. Using your example, I was able to write my plugin. It took a little bit of modification, but everything is working exactly how I want it to. (And I won’t have a headache if I ever upgrade. )
    Time to go write more plugins…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘String Replace with the_content()’ is closed to new replies.