Title: Custom fields suggestion
Last modified: August 22, 2016

---

# Custom fields suggestion

 *  [Samar Hatem](https://wordpress.org/support/users/samar-hatem/)
 * (@samar-hatem)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/custom-fields-suggestion/)
 * Hi,
    I was editing a ready made theme and I had to create custom fields for nutritional
   facts, in my test I created only 3 fields and as I saw I should declare each 
   one in my code like that:
 *     ```
       <div>
               <span class="item">Protein</span>
               <span class="value"><?php echo get_post_meta($post->ID, 'Protein',true); ?></span>
           </div>
           <div>
               <span class="item">Sodium</span>
               <span class="value"><?php echo get_post_meta($post->ID, 'Sodium',true); ?></span>
           </div>
           <div>
               <span class="item">Sugars</span>
               <span class="value"><?php echo get_post_meta($post->ID, 'Sugars',true); ?></span>
           </div>
       ```
   
 * but what if the admin wanted to add an extra field, say Cholesterol?
    how can
   I make it responsive to each field the admin add? how to make it able to add 
   every new field automatically? I though there might be a loop which loops through
   these meta data and echo them out automatically without having to declare each
   one of them, it is possible?
 * _[please continue with your original topic at [https://wordpress.org/support/topic/custom-fields-145?replies=2](https://wordpress.org/support/topic/custom-fields-145?replies=2)–
   [http://codex.wordpress.org/Forum\_Welcome#Where\_To\_Post](http://codex.wordpress.org/Forum_Welcome#Where_To_Post)]_

The topic ‘Custom fields suggestion’ 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/)
 * 0 replies
 * 1 participant
 * Last reply from: [Samar Hatem](https://wordpress.org/support/users/samar-hatem/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/custom-fields-suggestion/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
