1179 posts
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 200 and 499 users
  • Has been a member for 6-7 years
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! :)

219 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
  • United Kingdom
NuclearThemes says

Are you echoing the function?

3219 posts
  • Sold between 5 000 and 10 000 dollars
  • United States
  • Bought between 10 and 49 items
  • Has been a member for 4-5 years
  • Exclusive Author
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);
?>
1179 posts
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 200 and 499 users
  • Has been a member for 6-7 years
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