Title: Help with If Else (variable)
Last modified: August 19, 2016

---

# Help with If Else (variable)

 *  [firstain](https://wordpress.org/support/users/firstain/)
 * (@firstain)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/help-with-if-else-variable/)
 * Hi,
 * I am making a wordpress theme, my first ever, and in that i wanted to display
   featured posts thumbnails. The user has to enter post IDs in the dashboard settings
   and those IDs’ thumbnail and post title will be displayed.
 * After thorough research, i came across 1 tutorial which fulfilled my aim with
   the help of a plugin. The code had to be entered into my functions.php file. 
   Here’s the code:
 * _[code moderated as per [forum rules ](http://codex.wordpress.org/Forum_Welcome)-
   please use the [pastebin](http://pastebin.com/)]_
 * Now, to show this feature, i had to enter the following code wherever i want 
   to display these featured thumbnails (homepage)
 *     ```
       <h3>Featured</h3>
       <?php featuredpostsList(); ?>
       ```
   
 * Everything is fine and normal at this point. But, when my theme will be newly
   used,there will be no posts and hence user cannot enter post IDs to display the
   featured posts thumbnail. In that case, i don't want anything to show at all 
   in that space. But how do i do it?
 * At present, when post IDs are not entered in my dashboard settings, this is displayed:
 * Featured (in h3)
    None Found (in bold)
 * I don't want this to appear. This is done by this coding from the above code:
 *     ```
       <?php }
       } else {
       echo $before ."None found". $after;
       ```
   
 * So how do i achieve my goal?
 * I know i have to wrap...
 *     ```
       <h3>Featured</h3>
       <?php featuredpostsList(); ?>
       ```
   
 * ...in an if-else statement. But what could be the exact coding? what variable/
   condition to use? I tried if(isset... and if(get_option... but nothing works.
   They remove the thumbnails even when post IDs r entered in dashboard settings.
 * Please help me with the exact coding required in if-else (or any other solution
   if its there).
 * Phew...!!!
 * Thanks.

The topic ‘Help with If Else (variable)’ is closed to new replies.

## Tags

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

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 0 replies
 * 1 participant
 * Last reply from: [firstain](https://wordpress.org/support/users/firstain/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/help-with-if-else-variable/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
