Thumbnail not showing in sidebar
-
Hi!
I have a small problem with my sidebar thumbnail posts. I guess it’s an issue of the CSS but i don’t know what is exactly. It’s about the auto-resize of them. In the #content works perfectly but with the same values it doesn’t work in the #sidebar.
This is the code i’ve put in my sidebar:
<li><a href="<?php the_permalink(); ?>"><?php dp_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '"'); ?></a><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
And this is the dp_attachment_image function (in functions.php):
# Displays post image attachment (sizes: thumbnail, medium, full) function dp_attachment_image($postid=0, $size='thumbnail', $attributes='') { if ($postid<1) $postid = get_the_ID(); if ($images = get_children(array( 'post_parent' => $postid, 'post_type' => 'attachment', 'numberposts' => 1, 'post_mime_type' => 'image',))) foreach($images as $image) { $attachment=wp_get_attachment_image_src($image->ID, $size); ?><img src="<?php echo $attachment[0]; ?>" <?php echo $attributes; ?> /><?php } }
This is the CSS that works in the index for a resize of the thumbnail (150×150 default) to 94px width:
#content .post img { border:3px solid #EFEFEF; float:left; margin:2px 8px 4px 0; width:94px; }
I’ve tried with #sidebar .post img and same values but it shows the thumb in 150×150 as it doesn’t take the css.
Thanks for ur help!
- The topic ‘Thumbnail not showing in sidebar’ is closed to new replies.