• Jeremy

    (@alittlenegative)


    Hi, I’m having an issue with captions being grabbed and displayed on the front page of my site in the short excerpts of each post. I’d rather have them not included. I did a bit of research and I’m confused about whether or not excerpts should have shortcodes (which I think include captions?) removed. Is it normal behavior for a theme to display them on the front page, or is it an error? And what’s the easiest way to remove them? I don’t use manual excerpts, if that makes a difference. We’re using kind of an aging theme, which might be part of the issue.

    Site: http://bit.ly/1XUDc5i

    Thank you for your help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi there!

    I think I see what you mean. This code will remove the captions box to the right of the image:


    Screenshot

    Try this snippet of CSS to hide them:

    .wp-caption-text {
      display: none;
    }

    You can paste this code in your child theme’s style.css or in a custom css plugin such as Simple Custom CSS.

    I hope that helps!

    Cheers,

    Luke the Daft Duke

    Thread Starter Jeremy

    (@alittlenegative)

    Thank you for responding! That code does hide the captions but it does so for all pages. I wanted to hide them on my home page while still having them show on the single article page.

    Thread Starter Jeremy

    (@alittlenegative)

    Based on some searching through the forums, it looks like the easiest way to remove captions from the front page excerpts might be to strip shortcodes? I’m seeing a lot of threads but I don’t know enough php to know where to insert the code.

    for instance: https://wordpress.org/support/topic/image-caption-being-pulled-into-excerpt?replies=9

    I don’t think you need to use function, it’s just a matter of being super specific with the CSS.

    Because it’s an old theme, its just a little tricky.

    How about this…

    Remove the captions everywhere using the previous code…

    .wp-caption-text {
      display: none;
    }

    but then display them on the individual post pages:

    (i.e. so they would appear here)

    .list-news .single .wp-caption-text {
      display: block;
    }

    I think that will do the trick but I can’t test this theme out – not even sure what it’s called 🙂 so give it a try and if not I’ll take another shot.

    I hope that helps!

    Luke the Daft Duke

    Thread Starter Jeremy

    (@alittlenegative)

    That worked perfectly! I didn’t know you could do that with css, that’s good to know.

    Thanks so much for helping, I appreciate it.

    No problem. Your welcome! 🙂

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

The topic ‘remove captions from front page’ is closed to new replies.