Title: Help Needed
Last modified: August 20, 2016

---

# Help Needed

 *  Resolved [ttheron](https://wordpress.org/support/users/ttheron/)
 * (@ttheron)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/help-needed-20/)
 * Hi
 * Can someone please help me with some custom coding that I am trying to get working
   in WP posts.
 *     ```
       <?php if(get_post_meta($post->ID,'is_featured',true) {?>
       <h3><a href="<?php echo get_post_meta($post->ID,'listingweb',true);?>" title="<?php the_title(); ?>" target="_blank"><?php the_title(); ?></a></h3>
       <?php }elseif(get_post_meta($post->ID,'is_featured',false) {?>
       <h3><?php the_title(); ?></h3>
       <?php }?>
       ```
   
 * Everything looks fine, but when I upload I get a blank screen.
 * Whereas if I remove the else statement is works fine – so what am I doing wrong?

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/help-needed-20/#post-2746465)
 * You’re missing a closing bracket on each of your if statements. Try:
 *     ```
       <?php if( get_post_meta( $post->ID, 'is_featured',true ) ) : ?>
       <h3><a href="<?php echo get_post_meta($post->ID,'listingweb',true);?>" title="<?php the_title_attribute(array('before' => '', 'after' => '', 'echo' => 1) ); ?>" target="_blank"><?php the_title(); ?></a></h3>
       <?php elseif  (get_post_meta($post->ID,'is_featured',false) ) : ?>
       <h3><?php the_title(); ?></h3>
       <?php endif;?>
       ```
   
 *  Thread Starter [ttheron](https://wordpress.org/support/users/ttheron/)
 * (@ttheron)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/help-needed-20/#post-2746472)
 * Hi Esmi,
 * Thank you so much – at least now the page is showing. I knew I has missed something
   simple.
 * Can you answer 1 more question for me – why would the title not display if the
   post is not featured?
    `<h3><?php the_title(); ?></h3>` What am I missing here
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/help-needed-20/#post-2746475)
 * The first line of code above tells WP to ignore the whole code block if the post
   does not have “featured” custom field.
 *  Thread Starter [ttheron](https://wordpress.org/support/users/ttheron/)
 * (@ttheron)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/help-needed-20/#post-2746480)
 * shoot – that is not what I wanted – I wanted if the post was featured link the
   title and if the post is not featured just display the title.
 * The php manual from php.net is not very clear on how to do this.
 * How do I write this?
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/help-needed-20/#post-2746485)
 * Try:
 *     ```
       <?php if( get_post_meta( $post->ID, 'is_featured',true ) ) : ?>
       <h3><a href="<?php echo get_post_meta($post->ID,'listingweb',true);?>" title="<?php the_title_attribute(array('before' => '', 'after' => '', 'echo' => 1) ); ?>" target="_blank"><?php the_title(); ?></a></h3>
       <?php else : ?>
       <h3><?php the_title(); ?></h3>
       <?php endif;?>
       ```
   
 *  Thread Starter [ttheron](https://wordpress.org/support/users/ttheron/)
 * (@ttheron)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/help-needed-20/#post-2746487)
 * Oh my!!!
 * Thank you, thank you, thank you!!!!
 * I have been trying all sorts of coding today. You have saved me!!!
 * Finally can go home 😀
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years ago](https://wordpress.org/support/topic/help-needed-20/#post-2746496)
 * Glad I could help 🙂

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

The topic ‘Help Needed’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 2 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/help-needed-20/#post-2746496)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
