Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've been researching how to display thumbnails with rounded images, but every solution ends up running out of gas.

One trick I tried was wrapping the thumbnail in a division with the same size and shape, showing the image, but with CSS of "opacity:0" so that the actual image doesn't show. What shows is the background image for the division, and it's this, also that is styled using:

border-radius: 15px;

(plus other browser related hacks)

To do this on WordPress, I'm going to have to use inline styles, it seems, to give the same div the right background image using

the_post-thumbnail()

Seems to lead to nowhere because I don't see a way to pull just the image url in a way that I can call within

<div style="   ";

Any ideas?

I'm trying to avoid Javascript, but if that's the only way...

Here's a link to the method I mentioned:

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You can get the thumbnail URL with wp_get_attachment_image_src and get_post_thumbnail_id:

$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail' );
echo $src[0];
share|improve this answer
    
Thanks, that works well. –  jw60660 Oct 9 '11 at 4:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.