Title: Displaying Custom Fields
Last modified: August 19, 2016

---

# Displaying Custom Fields

 *  Resolved [tomslattery](https://wordpress.org/support/users/tomslattery/)
 * (@tomslattery)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/displaying-custom-fields/)
 * Hiya,
 * I am trying to display a custom field in my post. From what I’ve read, the ‘get_meta’
   code needs to be placed in the Loop. Problem is, I haven’t seen an example anywhere
   where they say “edit this file, place the code here.” For simplicity, I am working
   with the WordPress standard template. My custom field is named “list_price”. 
   All I want to to is have that value show up the post. What code do I put where?
 * Thanks!
    ~TPS

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Jess](https://wordpress.org/support/users/jessn/)
 * (@jessn)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/displaying-custom-fields/#post-1229138)
 * Something like this:
 *     ```
       <?php //get list_price (custom field) ?>
       <?php $list_price = get_post_meta($post->ID, 'list_price', true); ?>
       <?php echo $list_price; ?>
       ```
   
 * Put that somewhere in your loop, between the “if has post, while has posts, the
   post” and before the “endwhile”.
 *  Thread Starter [tomslattery](https://wordpress.org/support/users/tomslattery/)
 * (@tomslattery)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/displaying-custom-fields/#post-1229198)
 * That worked. Thanks!
 *  Thread Starter [tomslattery](https://wordpress.org/support/users/tomslattery/)
 * (@tomslattery)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/displaying-custom-fields/#post-1229232)
 * I’m going a layer deeper: I would like to lead into the data with “List Price:“
 * So I did this:
 * <span style=”font-weight: bold”>List Price:</span>
    <?php //get list_price (custom
   field) ?> <?php $list_price = get_post_meta($post->ID, ‘list_price’, true); ?
   > <?php echo $list_price; ?>
 * Only problem with that is that every post will have that text in it whether or
   not the data shows up.
 * Is there a way to say “only display this text if there is data there”?
 * Thanks!
    ~TPS

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Displaying Custom Fields’ is closed to new replies.

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [tomslattery](https://wordpress.org/support/users/tomslattery/)
 * Last activity: [16 years, 8 months ago](https://wordpress.org/support/topic/displaying-custom-fields/#post-1229232)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
