how to make an email address clickable in wordpress

how to add custom thumbnail size to wordpress

From wordpres 2.9 version we got the featured image option in wordpress.  We have given code to add custom thumbnail size to wordpress themes.  Means you can relate the image to wordpress post without showing in post.

how to add custom thumbnail size to wordpress

If you are using the wordpress 2.9.2 or greater version then this feature is available in your wordpress but you need to enable this feature in your worpdress by using following function.

open your functions.php file and put following code in that file for enable the featured post feature in your wordpress

add_theme_support( 'post-thumbnails' );

By default, WordPress gives you some image sizes when you upload an image. These image sizes are:

* Thumbnail
* Medium
* Large
* Full (the image you uploaded)

For showing the the featured image in your post you can use the following code

if ( has_post_thumbnail() )

the_post_thumbnail( 'thumbnail' );  // for showing the thubnail.
the_post_thumbnail( 'medium' ); // for showing the medinum size thubnail image
the_post_thumbnail( 'full' );  // for showing the full size thubnail image

If you want to only show the specific image size in featured thubnail then use the following code.

add_filter( 'post_thumbnail_size', 'my_post_image_size' );

function my_post_image_size( $size ) {
$size = 'medium';
return $size;
}

 

For fixing the old images issue with featured images.
You can use the following article.
https://purabtech.in/media-library-not-displaying-images-after-importing-posts/

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

Leave a Reply

Your email address will not be published.