• Resolved myparsys

    (@myparsys)


    Hi, I have huemen theme and i did a little customization in single posts. i added thumbnails at above of the content by this code

    <?php if ( has_post_thumbnail() ):?>
    <div class="featured-image-wrap"><?php the_post_thumbnail( 'thumbnail', array( 'class' => 'alignleft' ) ); ?></div>
    <?php endif; ?>

    now, the problem is thumbnails shows up in every post type including videos, images etc… and i don’t want it this way.
    i would like thumbnails to only show up in standard post.
    there is code for this matter, but i don’t know how to find it.
    any helps would be appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey, Myparsys!

    That’s easy.

    Do it like this.

    <?php if( ! get_post_format() && has_post_thumbnail() ) : ?>
    
    	<div class="featured-image-wrap"><?php the_post_thumbnail( 'thumbnail', array( 'class' => 'alignleft' ) ); ?></div>
    
    <?php endif; ?>

    The standard post format isn’t actually a post format, so if you conditionally check whether a post contains a post format (other than the default standard), it will return false, because it’s set to… standard.

    Thread Starter myparsys

    (@myparsys)

    thank you Ahmad Awais,
    it worked!

    That’s great!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘conditioning thumbnail to show’ is closed to new replies.