Title: Simple custom field question
Last modified: August 19, 2016

---

# Simple custom field question

 *  Resolved [HorrorUK](https://wordpress.org/support/users/horroruk/)
 * (@horroruk)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/simple-custom-field-question/)
 * I’ve been working too long and my brain hurts, so if somebody could help me with
   this simple problem, that would be great.
 * I have a section on my site with various information for events going on in my
   county. The main information is being added using custom fields so, for example,
   the town is a custom field and I just want it to simply print it out as it is
   typed in.
 * I’m using the code below, but it doesn’t work. It shows the section on Town: 
   in bold, but it doesn’t show the actual info.
 * I have checked, and it is in the correct place in the post custom field.
 *     ```
       <?php if( get_post_meta($post->ID, "eventtown", true) ): ?>
       <b>Town: </b><?php echo $eventtown; ?>
       <br />
       <?php else: ?>
       <?php endif; ?>
       ```
   
 * Here is the URL if it helps:
    [http://inhampshire.net/2010/04/23/horror-uk](http://inhampshire.net/2010/04/23/horror-uk)

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/simple-custom-field-question/#post-1475651)
 * are you trying to echo the custom field value?
 *     ```
       <?php if( get_post_meta($post->ID, "eventtown", true) ): ?>
       <b>Town: </b><?php echo get_post_meta($post->ID, "eventtown", true); ?>
       <br />
       <?php else: ?>
       <?php endif; ?>
       ```
   
 *  Thread Starter [HorrorUK](https://wordpress.org/support/users/horroruk/)
 * (@horroruk)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/simple-custom-field-question/#post-1475654)
 * Thanks, that’s exactly what I needed :o)

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

The topic ‘Simple custom field question’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [HorrorUK](https://wordpress.org/support/users/horroruk/)
 * Last activity: [16 years, 1 month ago](https://wordpress.org/support/topic/simple-custom-field-question/#post-1475654)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
