Title: Custom fields
Last modified: August 22, 2016

---

# Custom fields

 *  Resolved [Samar Hatem](https://wordpress.org/support/users/samar-hatem/)
 * (@samar-hatem)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/custom-fields-145/)
 * Hi, I have 2 questions 🙂
    first one is: is it possible to make different templates
   for single post displaying? second and most important one: 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? thanks in advance..

The topic ‘Custom fields’ is closed to new replies.

## Tags

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

 * 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-145/)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
