• I am using a theme that grabs the post thumbnail from the custom fields meta. It also uses the the_content_limit which I am trying to get rid of. When I change the the_content_limit line back to the_content, I am getting double thumbnails since by default it grabs the image as well. Is there a way to tell the_content to not include the post thumbnail?

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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.

    Thread Starter Diventare Creative

    (@wms-group)

    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.

    Thread Starter Diventare Creative

    (@wms-group)

    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.

    Thread Starter Diventare Creative

    (@wms-group)

    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… 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘the_content without thumbnails?’ is closed to new replies.