Customizing the WordPress post thumbnail

Customizing a WordPress post thumbnail can be done with the help of WordPress prebuilt function the_post_thumbnail() which is pretty used in almost all themes depending on the requirement

Customize the WordPress post thumbnail

In order to customize the thumbnails ,copy and paste the respective code snippets into the theme and place it in the respective block .

  1. To add class to post thumbnail
    the_post_thumbnail( 'full',['class' => 'img-responsive img any_other_class'] );
  2. To add alt tag to the post thumbnail of thumbnail as current post for SEO purpose
    the_post_thumbnail( 'full',['alt' => get_the_title()] );
  3. To add itemprop as image schema to post thumbnail
    the_post_thumbnail( 'full',['itemprop' => 'image'] );
  4. To add title tag to the post thumbnail of thumbnail as current post for SEO purpose
    the_post_thumbnail( 'full',['title' => get_the_title());
  5. To add all of the above elements to post thumbnail
    the_post_thumbnail( 'full',['itemprop' => 'image','class' => 'img-responsive img','title' => get_the_title(),'alt' => get_the_title()] );

Adding the post thumbnail can be found in the following article.

thumbnail,wordpress