Display post thumbnail

436

Last updated

Added

Informations

This code get the post thumbnail url or img tag.

Code

Display the post thumbnail URL
<?php the_post_thumbnail_url(); ?>

 

Get the post thumbnail URL
<?php get_post_thumbnail_url(); ?>

 

Display the post thumbnail (img tag)
<?php the_post_thumbnail(); ?>

 

Get the post thumbnail (img tag)
<?php get_post_thumbnail(); ?>

 

You can specify size :

<?php the_post_thumbnail(‘thumbnail’); ?> Thumbnail (150 x 150 hard cropped)

<?php the_post_thumbnail_url(‘medium’); ?> Medium resolution (300 x 300 max height 300px)

<?php get_post_thumbnail(‘medium_large’); ?> Medium Large resolution (768 x infinite height)

<?php get_post_thumbnail_url(‘large’); ?> Large resolution (1024 x 1024 max height 1024px)

<?php the_post_thumbnail(‘full’); ?> Full resolution (original size uploaded)

Contribute to this page

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *