Wordpress - Custom field thumbnail


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php if( get_post_meta( $post->ID, "thumbnail", true ) ) { ?>
  2. <a href="<?php the_permalink() ?>" rel="bookmark" class="thumb">
  3. <img src="<?php echo get_post_meta( $post->ID, "thumbnail", true ); ?>" alt="<?php the_title(); ?>" width="" />
  4. </a>
  5.  
  6. <?php }else{ ?>
  7. <a href="<?php the_permalink() ?>" rel="bookmark" class="thumb">
  8. <img src="<?php bloginfo('template_directory'); ?>/images/temp.gif" alt="Image Coming Soon" width="" />
  9. <span></span>
  10. </a>
  11. <?php } ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.