WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know similar questions have been asked dozens of times but I'm just not understanding how to display custom fields. I'm using woocommerce and want to display a custom field value on product pages.

I add the custom field "current_promotions" and a value to a product, and have tried adding this to the content-product.php template, but I'm getting nowhere:

<?php $postid = get_the_ID(); ?>

<?php get_post_meta($post_id, $key, $single); ?>
share|improve this question
up vote 2 down vote accepted

This should do it

<?php echo get_post_meta( get_the_ID(), 'current_promotions', true ); ?>
share|improve this answer

protected by Community Mar 20 '14 at 19:23

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.