Title: understanding custom fields
Last modified: August 19, 2016

---

# understanding custom fields

 *  Resolved [kmaier](https://wordpress.org/support/users/kmaier/)
 * (@kmaier)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/understanding-custom-fields/)
 * if i name a custom field with in a page in the admin: “home_vision”
 * and give it a value like: “It is our aggressive pursuit of excellence blah blah
   blah”
 * is there a way i can display that value text to an area on a specific page? Or
   is that not really what custom fields are for?
 * thanks for helping me understand.
 * kmaier

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

 *  [Jess](https://wordpress.org/support/users/jessn/)
 * (@jessn)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/understanding-custom-fields/#post-1298025)
 * You’ll have to add something to your template files, like single.php or index.
   php
 *  <?php $vision = get_post_meta($post->ID, ‘home_vision’, true); ?>
    <p><?php 
   echo $vision; ?></p>
 *  Thread Starter [kmaier](https://wordpress.org/support/users/kmaier/)
 * (@kmaier)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/understanding-custom-fields/#post-1298045)
 * i added it to my home.php but i am not seeing anything. do i need to target a
   specific ID? i’m using pages.
 *  Thread Starter [kmaier](https://wordpress.org/support/users/kmaier/)
 * (@kmaier)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/understanding-custom-fields/#post-1298049)
 * got it!!!
 * <?php $vision = get_post_meta(43, ‘home_vision’, true); ?>
    <p><?php echo $vision;?
   > – hi</p>
 * Thanks Jessn!~
 *  Thread Starter [kmaier](https://wordpress.org/support/users/kmaier/)
 * (@kmaier)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/understanding-custom-fields/#post-1298129)
 * can i have the fields have the same name but generate different values based 
   off whats in the admin?
 *     ```
       <?php if (
       $sideHeader = get_post_meta(2, 'side_header', true)) {
       echo $sideHeader;
       } elseif (
       $sideHeader = get_post_meta(5, 'side_header', true)) {
       echo $sideHeader;
       } elseif (
       $sideHeader = get_post_meta(8, 'side_header', true)) {
       echo $sideHeader;
       } elseif (
       $sideHeader = get_post_meta(10, 'side_header', true)) {
       echo $sideHeader;
       } elseif (
       $sideHeader = get_post_meta(12, 'side_header', true)) {
       echo $sideHeader;
       } else {
       echo '';
       }
       ?>
       ```
   
 * whatever i do it only comes up with the first one in the statement on all pages.
 *  [simplistik](https://wordpress.org/support/users/simplistik/)
 * (@simplistik)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/understanding-custom-fields/#post-1298137)
 * Yes you can. But it looks like your condition might be wrong. Where else is $
   sideHeader defined?
 * From the initial look it seems if you should be doing something like:
 *     ```
       $sideHeader = get_post_meta($post->ID, 'side_header', true);
       if ( !empty($sideHeader) ) echo $sideHeader;
       ```
   
 *  Thread Starter [kmaier](https://wordpress.org/support/users/kmaier/)
 * (@kmaier)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/understanding-custom-fields/#post-1298142)
 * thanks simplistik that worked just like what i was trying to do for the last 
   hour or so…ha
 * really appreciate it

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

The topic ‘understanding custom fields’ is closed to new replies.

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

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
