Celebrating 7 Years! Get up to $30 off GeneratePress Premium!

[Support request] Remove Content image from excerpt

Home Forums Support [Support request] Remove Content image from excerpt

Home Forums Support Remove Content image from excerpt

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #495371
    Weatherly

    Does anyone know how to kill the content image and caption from the excerpt, perhaps something some code for the child theme functions?

    A little context:
    We have imported this site from Joomla. And we WANT featured images because many articles (now posts) had none. But others have content images, the same ones as featured, and right in the excerpt.

    I tried this: Easy Custom Auto Excerpt plugin By tonjoo to get rid of the few content images, but sadly, it still left a giant caption in the way, as well as interfering with Generatepress Read More buttons.

    So I’m back to thinking we need something in the functions but am not enough a PHP expert to know what exactly it would need. Any suggestions?

    GeneratePress 2.0.2
    GP Premium 1.5.6
    #495518
    Leo
    Staff
    Customer Support

    Hi there,

    I’m not 100% clear on the question but WordPress strips all HTML in excerpt by default so your content images and styles in your posts shouldn’t show in excerpt.

    If it’s showing then likely because you are using the more tag which includes everything: https://docs.generatepress.com/article/using-the-more-tag/

    Let me know if this helps.

    #495541
    Weatherly

    ๐Ÿ™ It is likely that tag is in there on some. Is there no way to work around it? As I said its a very big site with lots of old articles from before the import. It would be too much to get rid of them all manually. I did try and manually comment it out and it didn’t seem to help in any case.

    #495655
    Leo
    Staff
    Customer Support

    Can you guide me to the post you are referring to?

    Most of them are featured images from what I can see.

    #496115
    Weatherly

    ok is there somewhere I can send the link? I don’t want to publicly link to the dev site.

    #496117
    Leo
    Staff
    Customer Support

    I can see your site in the link provided in the original topic.

    Just need to know which post you are referring to.

    #496276
    Weatherly

    here is the path to the page (its a bit weird still) 2017/03/23/the-original-medicinal-plant-gatherers-conservationists/

    here is the category (its at the top)
    category/welcome-united-plant-savers/resources/featured-conservation-articles/

    there are more but that is the most obvious one

    #496491
    Leo
    Staff
    Customer Support

    Definitely not the best way but give this CSS a shot:

    .archive img.size-full:not(.wp-post-image) {
        display: none;
    }
    #496580
    Weatherly

    unfortunately that removes it from the post too. we only wanted gone from the category page excerpt. ๐Ÿ™

    #496602
    Leo
    Staff
    Customer Support

    Edited the code above.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.