ThemeForest

get_post_meta in sidebar

979 posts
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Philippines
  • Referred between 100 and 199 users
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! :)

8 months ago
177 posts
  • Has been a member for 1-2 years
  • Exclusive Author
  • Bought between 10 and 49 items
  • United Kingdom
  • Referred between 1 and 9 users
NuclearThemes says

Are you echoing the function?

8 months ago
2211 posts
  • Has been a member for 1-2 years
  • Exclusive Author
  • Sold between 1 and 100 dollars
  • Bought between 10 and 49 items
  • United States
OrganicBeeMedia 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);
?>
8 months ago
979 posts
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Philippines
  • Referred between 100 and 199 users
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 :)

8 months ago
by
by
by
by
by