Forums

[resolved] [Plugin: Post Thumbs] Settings to not display an image if post has no image? (2 posts)

  1. charmedworks
    Member
    Posted 2 years ago #

    Hi,

    Anyone know how to set Post Thumbs so that, if there is no image in a post, no thumb is displayed?

    We would like this for layout purposes (we can set the default image to a small spacer, but it still gets the CSS treatment of the thumbs which is tweaking our design).

    Thank you in advance!

  2. charmedworks
    Member
    Posted 1 year ago #

    I couldn't figure a way to do this with Post Thumbs, so I use a custom image instead:
    <a href="<?php the_permalink() ?>"><?php $imgtxt = get_post_custom_values("Image Title"); $values = get_post_custom_values("Image"); if ( $values != '' ) { ?><img src="<?php echo $values[0]; ?>" alt="<?php if( $imgtxt != '' ) { echo $imgtxt[0];} ?>" width="272" title="<?php if( $imgtxt != '' ) { echo $imgtxt[0];} ?>" /><?php } ?>
    This may be a unneeded modification with the new availibitliy of thumbnails in WordPress 2.9.2+ (I'm not sure it's the best way to achieve the affect now) - but I thought I'd share in case it's useful to anyone.

Topic Closed

This topic has been closed to new replies.

About this Topic