wpfolio icon indicating copy to clipboard operation
wpfolio copied to clipboard

Add min-height to thumbnails for category view

Open slambert opened this issue 15 years ago • 3 comments

Not sure this is needed, but if someone were to not have an image in the post, it wouldn't throw off the layout.

slambert avatar Aug 17 '10 04:08 slambert

Looked at this for a bit and I don't think it's a style issue. In functions.php the get_thumb function assigns a thumbnail from what's in the gallery if a featured image wasn't chosen, but it doesn't do anything if there are no images in the post. Seems like you'd need to have another function that assigns a ready-made thumbnail to posts without images, then change the thumbnail conditional in category.php. Does that make sense? Something along the lines of:

in functions.php:

function make_thumb() {
    $thumb = 'images/default-thumb.png';
}

and in category.php:

if (post_has_images) {
    if (has_post_thumbnail()){
        the_post_thumbnail();
    } else {
        echo get_thumb(...);
    }
} else {
    make_thumb();
}

laras126 avatar Feb 04 '11 22:02 laras126

Ah, smart!

what about: ...(snip)... } else { ?> <?php }

Check my markup, but basically if there's no image, then throw in a css span that we can create a min-height on.

The image could work, but it feels too much like a spacer.gif to me. Plus the min-height might be easier to change if people want larger thumbnails, which should be coming in the future.

slambert avatar Feb 05 '11 00:02 slambert

Working on this!

laras126 avatar Feb 08 '11 02:02 laras126