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 .
- To add class to post thumbnail
the_post_thumbnail( 'full',['class' => 'img-responsive img any_other_class'] );
- To add alt tag to the post thumbnail of thumbnail as current post for SEO purpose
the_post_thumbnail( 'full',['alt' => get_the_title()] );
- To add itemprop as image schema to post thumbnail
the_post_thumbnail( 'full',['itemprop' => 'image'] );
- To add title tag to the post thumbnail of thumbnail as current post for SEO purpose
the_post_thumbnail( 'full',['title' => get_the_title());
- 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
Comments for this post