• Resolved alexjames01

    (@alexjames01)


    Hey,

    I’m trying to find a way to get the content of a post into a $variable so i can modify the content in the loop (on the fly) using str_replace and then display it.

    The reason for this is that the post content is coming from a rss feed (an image service) and the picture displayed on the post is a thumbnail. I need to change the URL of the IMG tag so it displays the full picture.

    The service has different RSS feeds for thumbnails, medium sized images, and full sized images. All images have similar urls except they end in: -Th.jpg (thumbnail) -Med.jpg, and -Lg.jpg for large images. So using str_replace in variable that holds the content would easily work.

    I am pulling the thumbnail RSS feed which is also being put into a wordpress post. I need it to PULL the thumbnail feed for the thumbnail image on the front page… but when clicked, i would like to have the large image displayed.

    Only way i can think to do this is editing the content within the template file which would mean i need to:

    – Set the post content as a variable
    – use STR_REPLACE to replace -Th.jpg with -Lg.jpg
    – Display the new content

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Getting the_content into a PHP variable…’ is closed to new replies.