WordPress.org

Forums

[resolved] Is there a way to have a "cover image" for each post? (7 posts)

  1. ransom1337
    Member
    Posted 2 years ago #

    Hello,

    I'm setting up a WordPress that will have posts of varying types (i.e. some will be image galleries, others will be a single image, some will just be text-based).

    On the index page where all the latest posts are shown, I'd like each post to have a 'cover image' to give the user an idea of the content of the post. This image won't be used inside the post once the user has clicked on it, only for the front page.

    Does anyone know if there a plugin for this, please?

    Thanks.

  2. ransom1337
    Member
    Posted 2 years ago #

    Oh and of course it'll need to hide the content of the post so that it's not shown in the index. Thanks for any help!

  3. Michael
    Forum Moderator
    Posted 2 years ago #

    consider using the 'featured image'

    http://codex.wordpress.org/Post_Thumbnails

    as this is used independant of 'the_content()' simply don't use the_content() or the_excerpt(); in your index loop;

  4. ransom1337
    Member
    Posted 2 years ago #

    Brilliant, thanks for your help alchymyth, I didn't realise there was a Post Thumbnail feature.

    This has unearthed another question for me. I'm trying to edit my index loop as you suggested, but the "have_posts" loop only contains this:

    <?php get_template_part( 'content', get_post_format() ); ?>

    Isn't this where the_excerpt(); and the_content() should be? I think it used to be, anyway. Do you know where I might be able to find them now, please?

  5. Michael
    Forum Moderator
    Posted 2 years ago #

    just follow the hint to content.php and look for the code there;

    http://codex.wordpress.org/Function_Reference/get_template_part

    the line is basically including a file content.php or some content-{???}.php

    caveat: that file might also be used for other pages such as archive pages; if you only want your edits to have effect on the front page, you might need to wrap them into conditional statements using some of the conditional tags http://codex.wordpress.org/Conditional_Tags

  6. ransom1337
    Member
    Posted 2 years ago #

    Excellent advice, I now have this all sorted. Thanks!

  7. ransom1337
    Member
    Posted 2 years ago #

    Forgot to check as resolved.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.