Title: Coding Question on statement if..else
Last modified: August 20, 2016

---

# Coding Question on statement if..else

 *  Resolved [ProgenicRo](https://wordpress.org/support/users/progenicro/)
 * (@progenicro)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/coding-question-on-statement-ifelse/)
 * Hi there.
    I’m trying to set the featured images on the posts, and I want to 
   combine them with the adsense leadin.
 * I want to make it somehow if there is no featured image, to show up the adsense
   instead. So i did this:
 *     ```
       if ( has_post_thumbnail() ) {
       the_post_thumbnail();
       }
       else {
                if ($this->options['kill_inline'])
                   $inline = '' ;
                 else
                   $inline = 'style="' . $show_leadin .
                     ';margin:' . $margin . 'px;' . $border. '"' ;
                 $leadin =
                   stripslashes($this->options['info'] .
                     "<!-- Post[count: " . $this->ezCount . "] -->\n" .
                     '<div class="ezAdsense adsense adsense-leadin" ' . $inline . '>' .
                     $this->options['text_leadin'] .
                     ($this->urCount++ < $this->urMax ? $unreal : '') .
                     "</div>\n" . $this->options['info'] . "\n") ;
       			 }
       ```
   
 * This code is working, but the problem is that the featured image appears on the
   top of the post, and is not alligned just like the adsense block.
    Do I have 
   to insert the thumbnail code of featured image anywhere else to take the place
   of the adsense block when it exists ?
 * [http://wordpress.org/extend/plugins/easy-adsense-lite/](http://wordpress.org/extend/plugins/easy-adsense-lite/)

Viewing 1 replies (of 1 total)

 *  [manojtd](https://wordpress.org/support/users/manojtd/)
 * (@manojtd)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/coding-question-on-statement-ifelse/#post-3213676)
 * I think you may need to add some styling `div`s around the `the_post_thumbnail();`
   call. Like this untested code snippet:
 *     ```
       echo "<div style='display:block'>" ;
       the_post_thumbnail();
       echo "</div>" ;
       ```
   
 * You will have to play with `div` style until you get it right.

Viewing 1 replies (of 1 total)

The topic ‘Coding Question on statement if..else’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/easy-adsense-lite_90b09b.svg)
 * [Easy Plugin for AdSense](https://wordpress.org/plugins/easy-adsense-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/easy-adsense-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/easy-adsense-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/easy-adsense-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/easy-adsense-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/easy-adsense-lite/reviews/)

## Tags

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

 * 1 reply
 * 2 participants
 * Last reply from: [manojtd](https://wordpress.org/support/users/manojtd/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/coding-question-on-statement-ifelse/#post-3213676)
 * Status: resolved