Images w/ Custom Fields Outside Loop
-
I’m looking to create a “Features” image carousel that pulls a custom field value from a post and echo it into a HTML img tag.
There will be three featured images, each with a url to the image in a custom field. I’ve tried using the following code but wasn’t sure how to use it when I’ll be using random post IDs.
<?php global $wp_query; $postid = $wp_query->post->ID; echo get_post_meta($postid, 'customField', true); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Images w/ Custom Fields Outside Loop’ is closed to new replies.