Forums

[resolved] Custom Field - Thumbnails (5 posts)

  1. wxwx
    Member
    Posted 3 years ago #

    Hi

    currently code i use for my custom field (thumbnail) is

    <?php if(get_post_meta($post->ID, "thumbnail", true)) {
    $size = getimagesize($_SERVER[""].get_post_meta($post->ID, "thumbnail", true)); ?>
    <img src="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>" alt="<?php the_title(); ?>" width="<?php echo $size[0]; ?>" height="<?php echo $size[1]; ?>" />
    <?php } ?>

    Question here. How to make it will appear No Thumbnail Image if we not fill the input on custom field?

  2. Ivovic
    Member
    Posted 3 years ago #

    how about putting:

    <?php else echo '<strong>No Thumbnail Image</strong>'; ?>

    directly after what you have there.

  3. wxwx
    Member
    Posted 3 years ago #

    Thanks Ivovic :P. you rock!

  4. johnrage
    Member
    Posted 3 years ago #

    Ivovic i have the same problem, did you fix?

  5. mrwangkai
    Member
    Posted 3 years ago #

    do you know how you can add a line of text above the image like lifehacker.com has?

Topic Closed

This topic has been closed to new replies.

About this Topic