WordPress.org

Ready to get started?Download WordPress

Forums

Easy AdSense
[resolved] Coding Question on statement if..else (2 posts)

  1. ProgenicRo
    Member
    Posted 1 year ago #

    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/

  2. manojtd
    Member
    Plugin Author

    Posted 1 year ago #

    I think you may need to add some styling divs 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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic