Title: insert custom fields in single.php
Last modified: August 20, 2016

---

# insert custom fields in single.php

 *  [4ella](https://wordpress.org/support/users/4ella/)
 * (@4ella)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/insert-custom-fields-in-singlephp/)
 * I have recently purchased price calculator script (not plugin) working perfectly
   on my buddypress blog in single.php, example here: [http://www.4ella.com/2011/11/hospitone-night-club-olbia/](http://www.4ella.com/2011/11/hospitone-night-club-olbia/)
 * In the code in single.php I have following code and I would like to change the
   value with value from custom fields:
 *     ```
       <fieldset><label><input type="radio" name="f_1" value="Price1" checked="checked" data-cost="60" /> Price1</label> <span class="staticPrice"><span class="hypen"> - </span>€60</span>
   
       <label><input type="radio" name="f_1" value="Price"  data-cost="70" /> Price</label> <span class="staticPrice"><span class="hypen"> - </span>€70</span></fieldset>
       </div>
       <div class="option o-2">
       ```
   
 * data-cost=”60″ is a value which I want to change dynamicaly depending on custom
   field in every post. How can I implement custom field code in every data-cost
   =”price1 custom field value” ?
    `data-cost="<?php echo get_post_meta($post->ID,'
   key', true); ?>"` doesnt work for me 🙁 , do I have to change something in functions.
   php to make it work ?

The topic ‘insert custom fields in single.php’ is closed to new replies.

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [4ella](https://wordpress.org/support/users/4ella/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/insert-custom-fields-in-singlephp/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
