Title: Else if here
Last modified: August 19, 2016

---

# Else if here

 *  [gioska](https://wordpress.org/support/users/gioska/)
 * (@gioska)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/else-if-here/)
 * How can do elseif “color2” condition in this code?
 * <?php if(get_post_meta($post->ID, ‘color’, single)!=””) { ?>
    <h5><?php the_title();?
   ></h5> <?php } else { ?> <h4><?php the_title(); ?></h4> <?php } ?>
 * —color2 is the second custom field key.—-

Viewing 1 replies (of 1 total)

 *  Thread Starter [gioska](https://wordpress.org/support/users/gioska/)
 * (@gioska)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/else-if-here/#post-910384)
 * resolved to my self ….the code below.
 *     ```
       <?php if(get_post_meta($post->ID, 'color', single)!="") { ?>
       <h5><?php the_title(); ?></h5>
       <?php } elseif (get_post_meta($post->ID, 'color2', single)!="") { ?>
       <h6><?php the_title(); ?></h6>
       <?php } else { ?>
       <h4><?php the_title(); ?></h4>
       <?php } ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Else if here’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [gioska](https://wordpress.org/support/users/gioska/)
 * Last activity: [17 years, 5 months ago](https://wordpress.org/support/topic/else-if-here/#post-910384)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
