WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Include large full width image with the_excerpt()

[Resolved] Include large full width image with the_excerpt()

  • Hi,
    Hopefully someone is able to help me with this. I’m finding my ignorance knows no bounds.
    This is my site: gtsb
    I have my site set up with the homepage displaying excerpts of the most recent posts. I would like an image to show up with that excerpt (if there is one present in the post). I would also like that image to be full width. I have a screen shot here: http://www.filedropper.com/screenshot2012-04-03at125629pm that I uploaded to filedropper. I am currently using a function called Catch That Image that I found at wprecipes.com. It sort of does what I want. But I’m unsure how to control the image so I can make the width fill the full space. Not sure if this is the best method and if I can adjust it to do what I want. This avoids using custom fields (however i’d use that method as well if i knew how to). I’ve heard a lot about using custom fields and a few other methods, but have not been able to figure them out either.
    If someone can lead me in the right direction i would appreciate it

Viewing 15 replies - 1 through 15 (of 18 total)
  • Ok so I’ve found this add_image_size function that might work here http://www.studiograsshopper.ch/web-development/wordpress-featured-images-add_image_size-resizing-and-cropping-demo/

    Still trying to wade through how this would work and be applied.

    esmi

    @esmi

    Forum Moderator

    you could use css;
    example:

    img.thumbnail{width:560px;height:auto;margin: auto 0!important;}

    this will obviously stretch smaller images;

    or use:

    img.thumbnail{max-width:560px;height:auto;margin: auto 0!important;}

    and possibly give the image a more unique css class

    Thanks for the info.
    I’ll try to figure this out. I don’t find the WordPress Codex as being all that easy to follow and understand. But again i’m not very well versed in most of this stuff.

    esmi

    @esmi

    Forum Moderator

    Why not just use <?php the_post_thumbnail('full');?>?

    Alchymyth,
    yeah I tried that, and it works. However as I’m handing this site off to the client i want to make sure they’re not stretching their images.

    Esmi,
    I’ll give it a shot. Reason for not using it? Because I’ve never heard of it. Let’s see what happens.

    esmi

    @esmi

    Forum Moderator

    It is fully documented on the page I linked to above 🙂

    Yeah I’m going through it now. the problem I have with the “full documentation” is I’m not well versed in PHP to begin with so I end up pasting in code incorrectly. All the information i’m sure is there, but I’m not sure how to interpret it. I’m given the correct snippet but not the right place to put it. I’ve thrown quite a few errors, crashing the site in the process, because I placed something wrong in the functions.php file. I’ll be given a bit of code to place there, which is great, but i don’t know where to place it.

    esmi

    @esmi

    Forum Moderator

    You say that your home (main posts) page is currently display an excerpt, yes? If so, it will probably be using <?php the_excerpt();?>. If so, all you need to do is add <?php the_post_thumbnail('full');?> either immediately above or below <?php the_excerpt();?>.

    Esmi,

    Ok. I was thinking that was correct. I did it like this

    <div class="entry-content">
    			<?php the_post_thumbnail('full');?>
    			<?php the_excerpt(); ?>
    			<p><a class="readmore" href="<?php echo get_permalink(); ?>"> Read More...</a></p>
    		</div>

    I saw that I need to add this <?php add_theme_support( $feature ); ?> to my functions.php file as well right? I have added it now….don’t have any errors this time so it should be good to go…I hope 🙂 Not getting any images showing yet. But that might be an issue with the sample image i currently have on the site.

    esmi

    @esmi

    Forum Moderator

    Sorry – I assumed your theme already has support for featured images via add_theme_support(). Remember that you will need to specify the featured image for each post on the Add New/Edit Post page.

    Good to know. I’ll give this all a try. Thanks so much for the help

    Looks like it’s working! … mostly. I’m using <?php the_post_thumbnail('large');?> But I’m doing something wrong. I set the feature image as large (which i adjusted in Media to be 570 x 300, the height could be arbitrary, i’m not partial to it ) But after all that the image is sizing to 400×300. Not sure where that is being called and how to change it.

    jalacom

    It maybee gets the picture of 400×300 pixles because it did crop and set the sizes at the moment you uploaded it to WordPress. If you changed the “large” thumbnail sizes under “Media” recently you have to remove and reupload your picture again to make WordPress crop and/or resize your pictures to the new sizes you set under Media. It should then pull the correct size if you call for ‘large’.

    This might be the problem in your case?

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Resolved] Include large full width image with the_excerpt()’ is closed to new replies.
Skip to toolbar