get_post_meta doesn't work when creating a Widget
-
For some reason, when I try and use get_post_meta in a widget I’m creating, it doesn’t work. It isn’t pulling in the data. Here’s my code:
<?php query_posts('posts_per_page=1&meta_key=ll_trendingvideos&meta_value=yes'); if (have_posts()) : while (have_posts()) : the_post(); $videoembed = get_post_meta($post->ID, 'll_videoembedcode', true); ?> <p><?php the_title(); ?></p> <?php echo $videoembed; ?> <?php endwhile; endif; wp_reset_query(); ?>
While the_title works, the custom field is not displayed. Any ideas?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘get_post_meta doesn't work when creating a Widget’ is closed to new replies.