Title: Code help
Last modified: August 21, 2016

---

# Code help

 *  [stiwdio](https://wordpress.org/support/users/stiwdio/)
 * (@stiwdio)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/code-help-7/)
 * Wonder if someone can show me the error of my ways;
 *     ```
       <?php
       if ( get_post_meta($post->ID, 'image-url', true) ) {
       $post_back = get_post_meta($post->ID, 'image-url', $single = true);
       echo '<div class="image-holder" style="background: url(' . $post_back . ') no-repeat; background-size: 100%;">
       <div class="post-info" style="height: auto;">
       <p class="caption" style="width: 558px; padding-left: 12px; display: block;">
       Caption to go here</p>
       </div>
       </div>
   
       ';
       } else {
   
       	 ;
       }
       ?>
       ```
   
 * where it says Caption to go here, I’d like it to put in the caption from the 
   custom field;
 * <?php echo get_post_meta($post->ID, ‘image-caption’, true); ?>
 * But I know it needs to be formatted differently within the if else statement 
   as it’s not allowing me just to add that code in;
 * if anyone can help that be great

The topic ‘Code help’ is closed to new replies.

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [stiwdio](https://wordpress.org/support/users/stiwdio/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/code-help-7/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
