I’m using the following code to pull the value of a custom field:
<?php $featuredPosts = new WP_Query(); $featuredPosts->query('showposts=10&cat=4'); while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); ?> <li><img src="<?php $image = get_post_meta(get_the_ID(), 'folio-image', TRUE); ?>" alt="" /></li> <?php endwhile; ?>
But the code returns nothing, the output is as follows:
<li><img src="" alt=""></li>
Anyone know what the problem is:
Note: There is a custom field called ‘folio-image’ and it has a value.
- The topic ‘Not working’ is closed to new replies.