Title: If&#8230; Else statement
Last modified: August 18, 2016

---

# If… Else statement

 *  [skiorski](https://wordpress.org/support/users/skiorski/)
 * (@skiorski)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/if-else-statement/)
 * In one of the ‘Text’ widget I would like to input an image something like pic1
   to show to not logged in users (guest) but when someone logs in they will see
   pic2 (for logged in users only) of which guests will not have access to. (of 
   course, pic1 will not be needed to be shown to registered users)
 * So in a sense, it would be…
 * > <if>if you’re NOT logged in
   >  <img src=”pic1″> <else> <img src=”pic2″> </if>
 * If someone could code it this simple thing which I do not have the skillz to 
   do myself, I’d appreciate it.
 * TIA

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

 *  Thread Starter [skiorski](https://wordpress.org/support/users/skiorski/)
 * (@skiorski)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/if-else-statement/#post-586690)
 * Would something like this work?
 * > <?php global $userdata;
   >  get_currentuserinfo(); if ( ! $userdata->user_login){?
   > > <img src=”pic2″> <else> <img src=”pic1″> <?php }?>
 * I’m not sure. I need coders to look at it and give advice.
 *  Thread Starter [skiorski](https://wordpress.org/support/users/skiorski/)
 * (@skiorski)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/if-else-statement/#post-586710)
 * Never mind, I found it.
 *  [EhsanAhmad](https://wordpress.org/support/users/ehsanahmad/)
 * (@ehsanahmad)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/if-else-statement/#post-587160)
 * care to share ?

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

The topic ‘If… Else statement’ is closed to new replies.

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 3 replies
 * 2 participants
 * Last reply from: [EhsanAhmad](https://wordpress.org/support/users/ehsanahmad/)
 * Last activity: [18 years, 2 months ago](https://wordpress.org/support/topic/if-else-statement/#post-587160)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
