1180 posts
  • Affiliate Level 5
  • Author Level 5
  • Collector Level 2
  • Copyright Ninja
+3 more
mabuc
says

hello all,

I created a widget tab that pulls a data from a custom field but get_post_meta don’t seem to display.. How do you guys do that.. any help from you is appreciated! :)

221 posts
  • Trendsetter
  • 5 Years of Membership
  • United Kingdom
  • Author Level 3
+3 more
NuclearThemes
says

Are you echoing the function?

3439 posts
  • Author Level 4
  • Collector Level 2
  • Community Superstar
  • United States
+2 more
organicbee
says
mabuc said
hello all, I created a widget tab that pulls a data from a custom field but get_post_meta don’t seem to display.. How do you guys do that.. any help from you is appreciated! :)

its because your trying to use the get_post_meta outside of the loop….

<?php global $wp_query;
$postid = $wp_query?>post->ID;
echo get_post_meta($postid, 'CUSTOMFIELD', true);
?>
1180 posts
  • Affiliate Level 5
  • Author Level 5
  • Collector Level 2
  • Copyright Ninja
+3 more
mabuc
says
OrganicBeeMedia said
mabuc said
hello all, I created a widget tab that pulls a data from a custom field but get_post_meta don’t seem to display.. How do you guys do that.. any help from you is appreciated! :)

its because your trying to use the get_post_meta outside of the loop….

<?php global $wp_query;
$postid = $wp_query?>post->ID;
echo get_post_meta($postid, 'CUSTOMFIELD', true);
?>

yes, thanks for the help it works :)

by
by
by
by
by
by