WordPress.org

Ready to get started?Download WordPress

Forums

Show Different Size Post-Image on Index, Category than Single Page (5 posts)

  1. zvhipp
    Member
    Posted 2 years ago #

    Hello,
    I tried looking around but couldn't find plugin for this. I do not want to add new custom image size, that part I understand well, and this is not regarding featured image or post thumbnail.

    What I want is, regular post image thumbnail in post, which shows in excerpt if it falls in beginning, to be replaced with different image size when showing on home, or category page.

    I have regular thumbnail of 150 x 150 , but when viewed on index, I want it to be displayed in custom size of 150 x 90 (I have already added custom image size in functions.php.

    Is this possible?

    Thanks.

  2. dkotter
    Member
    Posted 2 years ago #

    Have you followed the instructions here? It basically guides you on how to create a new image size, which it sounds like you did, and then to use that size thumbnail instead of the default size:

    <?php the_post_thumbnail( 'NAME' ); ?>

    Replacing NAME with the name you used when setting up the new image thumbnail. You would add the above code to your index.php file probably, maybe your front-page.php file, depending on your theme. By doing that it will show up on the home page only.

  3. zvhipp
    Member
    Posted 2 years ago #

    HI, its not for featured/post thumbnail. Just regular image in post. For example, If I am displaying whole post even on home/category pages. Than it would show regular images in post which were inserted in paragraphs, those Image sizes.

    Thanks.

  4. dkotter
    Member
    Posted 2 years ago #

    Okay got ya. Using the term thumbnails threw me off, because that's usually means featured image, not just an image in the post. The problem with what you want to achieve is you aren't just showing an image, like you would be with using featured images. You're just showing the content of a post that might have an image in it. So the only thing I can think of is you'd have to filter that content on the home page to show a different size image, which is more complex. I'd recommend using featured images if you can, as that makes things a whole lot easier.

  5. zvhipp
    Member
    Posted 2 years ago #

    yes, content image, I have set content to 400 words to display on home/category pages using post limit plugin. I can use that plugin option to strip images and replace with post thumbnail. Only thing was I was trying to do this while already have 80 some posts so thought there may be other way inserting some code in functions.php which will change size automatically.

    But will try this way suggest. Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags