Title: Adding Custom Field using if/else statement
Last modified: August 20, 2016

---

# Adding Custom Field using if/else statement

 *  [andrewplatham](https://wordpress.org/support/users/andrewplatham/)
 * (@andrewplatham)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-field-using-ifelse-statement/)
 * Hello –
 * I’m not a programmer… But I know enough to know that I don’t know enough.
 * On this site: [http://1350kman.com](http://1350kman.com) you’ll notice that some
   of the posts have a little video icon next to them. They want to also have an
   audio icon for when they just have audio on their stories. The video is done 
   with a Custom Field.
 * So I’ve duplicated the css to display the microphone icon that I’ve created, 
   and uploaded this, as well as the icon. Next, in the list.php file, I’ve found
   this code which seems to control the “videoplus” custom field:
 * [http://wordpress.pastebin.ca/2081909](http://wordpress.pastebin.ca/2081909)
 * I duplicated the video part, and added an audio part:
 * [http://wordpress.pastebin.ca/2081907](http://wordpress.pastebin.ca/2081907)
 * when i test this on the site, the site will not display, and i only get an error
   which says:
 * “Parse error: syntax error, unexpected T_ELSEIF in /homepages/20/d278401371/htdocs/
   1350kman/wp-content/themes/playmaker6/assets/widgets/list.php on line 79”
 * Any assistance would be most appreciated!!
 * Andrew

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

 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-field-using-ifelse-statement/#post-2309154)
 *     ```
       <?php } elseif ( get_post_meta($post->ID, 'audio', true) ) { ?>
       ```
   
 * I believe you were missing a }
 *  Thread Starter [andrewplatham](https://wordpress.org/support/users/andrewplatham/)
 * (@andrewplatham)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-field-using-ifelse-statement/#post-2309161)
 * Rev, thanks so much! That worked, and I used your code in a few other spots in
   the archive.php to make it work!
 * [http://1350kman.com/](http://1350kman.com/)
 * Appreciate your help.
 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-field-using-ifelse-statement/#post-2309243)
 * Not a problem!! It gets confucing sometimes, but you gotta match up everything…
   open brackets need closing, open curly braces need closing, they always pair

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

The topic ‘Adding Custom Field using if/else statement’ is closed to new replies.

## Tags

 * [custom field](https://wordpress.org/support/topic-tag/custom-field/)
 * [ifelse](https://wordpress.org/support/topic-tag/ifelse/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 3 replies
 * 2 participants
 * Last reply from: [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/adding-custom-field-using-ifelse-statement/#post-2309243)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
