Revision: 27140
Updated Code
at May 24, 2010 20:18 by bdnnikki
Updated Code
<?php if (get_post_meta($post->ID, 'post-image', true) != "" ) : ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="borderimg"> <?php $thumbnail_image = get_post_meta($post->ID, 'post-image', true);?> <img src="<?php bloginfo('template_url'); ?>/scripts/timthumb.php?src=<?php echo $thumbnail_image; ?>&h=141&w=200&zc=1" alt="" /> </a> <?php endif; ?>
Revision: 27139
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 24, 2010 20:04 by bdnnikki
Initial Code
//this actually does the work without "adding post thumbnail"// function get_post_thumbnail() { $files = get_children('post_parent='.get_the_ID().'&post_type=attachment&post_mime_type=image'); if($files) : $keys = array_reverse(array_keys($files)); $j=0; $num = $keys[$j]; $image=wp_get_attachment_image($num, 'large', false); $imagepieces = explode('"', $image); $imagepath = $imagepieces[1]; $thumb=wp_get_attachment_thumb_url($num); echo "<div style='float: left; width: 175px; padding: 5px; margin-bottom: 15px;'><a href='"; the_permalink(); echo "'/><img src='".$thumb."'/></div>"; else: endif; }?> Then, add this to where you want the post thumbnail to display <?php get_post_thumbnail(); ?>
Initial URL
Initial Description
I looked everywhere trying to find some code that could show me how to display the post thumbnail if there is an image, but to display absolutely nothing if there isn't an image to display (most just either added an image or there was a broken image if there was nothing to display).
Initial Title
Activating the Post Thumbnail feature in Wordpress but not showing anything if there is no image to display
Initial Tags
post, wordpress
Initial Language
PHP