Title: Plugin if statement not working
Last modified: August 21, 2016

---

# Plugin if statement not working

 *  Resolved Anonymous User 12954455
 * (@anonymized-12954455)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/plugin-if-statement-not-working/)
 * Hello all
 * I’m developing a simple plugin to show some social icons based on options. I 
   have used if statements successfully before now with no issue. The following 
   code is causing me problems:
 *     ```
       <?php if ( get_option('sd_facebook_visible') ) {
       					echo '<li><a href="' . get_option('sd_facebook') .  $linkcontent['facebook'] . '</a></li>';
       				} ?>
       ```
   
 * I have done `var_dump(get_option('sd_facebook_visible'));` which returns the 
   following.
 * `string(1) "1"`
 * It is a checkbox on my options page. No matter what state the checkbox is it 
   just wont show any ideas?
 * Many Thanks

Viewing 1 replies (of 1 total)

 *  [Chris](https://wordpress.org/support/users/zenation/)
 * (@zenation)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/plugin-if-statement-not-working/#post-4034269)
 * For once, the link attribute href is not closed it has to be like
    `<a href="..."
   >link text</a>` You might also check the value a bit more clearer. Maybe this
   will do:
 *     ```
       $sd_facebook_visible = get_option( 'sd_facebook_visible' );
   
       if( $sd_facebook_visible === '1' || strtolower( $sd_facebook_visible ) === 'on' || (int) $sd_facebook_visible === 1 ) {
   
         echo '<li><a href="' . get_option('sd_facebook') . '">' . $linkcontent['facebook'] . '</a></li>';
   
       }
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Plugin if statement not working’ is closed to new replies.

## Tags

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

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [Chris](https://wordpress.org/support/users/zenation/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/plugin-if-statement-not-working/#post-4034269)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
