Automatically fill a custom field? (1 post)

  1. uncleguito
    Posted 6 years ago #

    I'm using the timthumb script for my theme, and I've been trying to make it so it automatically uses a specific thumbnail when one isn't defined by the author (ie. automatically fill the custom field for the thumbnail). Currently, whenever the custom field isn't defined or doesn't exist, nothing displays.

    In case you can't, would it be possible to do this through an if() statement on the theme? Currently, this is my code on the index file:

    <?php $gallery = get_post_meta($post->ID, 'gallery', true); ?>
    <img src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $gallery; ?>&h=100&w=120&zc=1" alt=""/>

    So maybe if gallery is false, display a certain image?

Topic Closed

This topic has been closed to new replies.

About this Topic