I believe the_content only includes the images you’ve inserted into the editor when writing the given post or page, can’t you simply remove that code from the post/page ‘s content since you’re using some other code to display those images.
Thanks t31os, that makes sense, but it only uses the custom fields on the homepage. If I take the_content out then it will not retrieve the post’s text.
I actually found the solution 🙂
<?php
ob_start();
the_content('Read the full post',true);
$postOutput = preg_replace('/<img[^>]+./','', ob_get_contents());
ob_end_clean();
echo $postOutput;
?>
I read this in a post from 2 months ago here
I had to tweak it a little for my needs but it seems to be working great.
Sorry i think you misunderstood what i was saying before, the images displayed by the function the_content are generated by code inserted into the editor when you have writen the given page or post.
Simply deleting the code inside that post or page for the image should in effect stop the_content outputing the images, leaving your custom code to grab the image(s) associated with that post or page.
Thank yout310s_. My last post did the trick for me. I appreciate your quick response!
Whatever works.. 😉
Just pointing out the solution you’ve used above is not really required, but if you’re happy with what you have, then we’re all good… 🙂