WordPress.org

Ready to get started?Download WordPress

Forums

Excluding Images from Posts on Homepage (7 posts)

  1. bigal109
    Member
    Posted 4 years ago #

    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.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 4 years ago #

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

  3. bigal109
    Member
    Posted 4 years ago #

    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?

  4. esmi
    Theme Diva & Forum Moderator
    Posted 4 years ago #

    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.

  5. asechrest
    Member
    Posted 4 years ago #

    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.

  6. bigal109
    Member
    Posted 4 years ago #

    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.

  7. bigal109
    Member
    Posted 4 years ago #

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

    Thanks for the help again guys.

Topic Closed

This topic has been closed to new replies.

About this Topic