Forums

Custom Field / Coding Question (2 posts)

  1. vincepettit
    Member
    Posted 2 years ago #

    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

  2. vincepettit
    Member
    Posted 2 years ago #

    Anyone?

Topic Closed

This topic has been closed to new replies.

About this Topic