Skip to content

Instantly share code, notes, and snippets.

@codee47
Last active December 18, 2015 12:18
Show Gist options
  • Save codee47/5781424 to your computer and use it in GitHub Desktop.
Save codee47/5781424 to your computer and use it in GitHub Desktop.
Display just the first thumbnail in wordpress.
<?php $first = true; ?>
<?php /*Post query*/ ?>
<?php if ( $first ) : ?>
<?php if ( has_post_thumbnail() ) { ?>
<figure class="post-thumb aligncenter">
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Link ehhez %s', 'akg' ), the_title_attribute( 'echo=0' ) ); ?>"><?php the_post_thumbnail( 'topstories-thumb' ) ?></a>
</figure>
<?php } ?>
<?php $first = false; ?>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment