Support » Fixing WordPress » Excluding Images from Posts on Homepage

  • Hi,

    I’ve been trying to exclude images from the content of my posts on my homepage. I’ve seen an example and used it before, but I wasn’t able to find it again.

    Anyone have any ideas? Thanks in advance.

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


    Forum Moderator

    Edit your home page template and replace the_content() with the_excerpt().

    That does remove the images, but now I’m getting a […] at the end of all my posts. I suppose that the_excerpt is a certain amount of characters?



    Forum Moderator

    Yes – 55 words. But you can use the Optional Excerpt within the Edit Post page to create your own custom excerpt using as many (or as few) words as you like. There are also a few plugins out there that help with customising the excerpt.

    Info on the_excerpt().

    Or, you could use the more tag and just not put any images above it.

    Or, you could use CSS’s display: none to hide images on the homepage. You’d have to add a CSS class or id to the post content in index.php and then reference img in that class/id. Not sure if you could use inline CSS to do that.

    The CSS trick worked, thanks asechrest. Now, I’m getting a gap between the post title and content. Is it possible to fix that?

    Thanks again.

    Turns it out is was a <br /> that I tucked away in my code. Wow, haha.

    Thanks for the help again guys.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Excluding Images from Posts on Homepage’ is closed to new replies.