Display Custom Field Data in a
-
Hi All,
I wonder if anyone can help?
I’ve been using custom fields quite a lot recently, which are amazingly handy. So far I’ve just displayed single bits of information using the following code:
<?php echo get_post_meta($post->ID, "Location", true);?>
However, now I’m trying to add Custom Field information that contains URLs of images in order to populate a Javascript slider. Here is an example of the code I’ve used so far:
<ul> <li><img src="<?php echo get_post_meta($post->ID, "Artist Image 1", true);?>" height="388" width="620"/></li> <li><img src="<?php echo get_post_meta($post->ID, "Artist Image 2", true);?>" height="388" width="620"/></li> <li><img src="<?php echo get_post_meta($post->ID, "Artist Image 3", true);?>" height="388" width="620"/></li> </ul>
However the slider still display the empty
<li>
s even when no images are loaded (e.g. no Artist Image 3 URL has been placed in the custom field).Does anyone know a way of how I can populate a
<ul>
with image URL placed in a or multiple custom fields? Any method will do, as long as it works and will only display whatever images are included for that particular post.Thanks,
Adam.
- The topic ‘Display Custom Field Data in a’ is closed to new replies.