Posted By

gd6d on 11/05/09


Tagged

wordpress fields custom


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

vintagekrug


Use Custom Fields in Wordpress


 / Published in: PHP
 

URL: http://forthelose.org/how-to-use-custom-fields-in-wordpress

  1. <?php $thereisimage = get_post_meta($post->ID, image, true);
  2. if($thereisimage){ ?>
  3. <a href="<?php the_permalink() ?>"><img src="<?php echo get_post_meta($post->ID, image, true); ?>" alt="Image" /></a>
  4. <?php }else{ ?>
  5. <a href="<?php the_permalink() ?>"><img src="images/default.png" alt="Default Image" /></a>
  6. <?php } ?>

Report this snippet  

You need to login to post a comment.