Title: Custom Field / Coding Question
Last modified: August 19, 2016

---

# Custom Field / Coding Question

 *  [vincepettit](https://wordpress.org/support/users/vincepettit/)
 * (@vincepettit)
 * [17 years ago](https://wordpress.org/support/topic/custom-field-coding-question/)
 * I use the following code to display an image at the left side of my articles,
   but i’m wondering if it would be possible to add something that if I have a flash
   file it will display that?
 *     ```
       <?php $thereisimage = get_post_meta($post->ID, image, true);
       if($thereisimage){ ?>
       	<img src="<?php echo get_post_meta($post->ID, image, true); ?>" alt="Article Picture" />
       <?php }else{ ?>
       	<img src="<?php bloginfo('url'); ?>/default.jpg" alt="Default Image" />
       <?php } ?>
       ```
   
 * It works from a custom field on the post (image), and what I was thinking is 
   to create another field named swf, but what I need is for the code to check to
   see if there is [image] OR [swf] and if there is display one of those, if not
   display the default image.
 * This is probably a really simple coding question but I’m not too hot on PHP!
 * Here’s an article page so you can see where the image is being displayed – [http://www.the-dish.co.uk/2009/06/08/past-present-and-future-eddy-temple-morris](http://www.the-dish.co.uk/2009/06/08/past-present-and-future-eddy-temple-morris)

Viewing 1 replies (of 1 total)

 *  Thread Starter [vincepettit](https://wordpress.org/support/users/vincepettit/)
 * (@vincepettit)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/custom-field-coding-question/#post-1100330)
 * Anyone?

Viewing 1 replies (of 1 total)

The topic ‘Custom Field / Coding Question’ is closed to new replies.

## Tags

 * [custom field](https://wordpress.org/support/topic-tag/custom-field/)
 * [image](https://wordpress.org/support/topic-tag/image/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [vincepettit](https://wordpress.org/support/users/vincepettit/)
 * Last activity: [16 years, 11 months ago](https://wordpress.org/support/topic/custom-field-coding-question/#post-1100330)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
