Create multiple sizes Thumbnail, Set Thumbail Depending Italy in wordpress
creating thumbnails in the thumbnail wordpress wordpressTrong be divided into three types: thumbnail, normal, largle. But in the process of code sites have many ways for many purposes, not necessarily using such fixed. Want a nice interface wordpress, nice wordpress themes, thumbnail in the interface is also very important.
media để chinh kích thước.”>When using the wordpress have to configure the size for three types of image size, go to settings -> media to resize.
To use the first thumbnail have declared in functions.php following command:
<?php add_theme_support('post-thumbnails');?>
thumbnail to call out, we use the following code put in where you want to display thumbnail
<?php
if(has_post_thumbnail()) the_post_thumbnail('thumbnail', array('class' => 'thumb'))
?>
these parameters often should I use to write for your reference is always the first parameter is “thumbnail” is one of the 3 standard as I have explained above, you can fill out a “normal” or ” largle “also. Or you can customize the size of your thumbnail, as follows:
the above code will retrieve the size of the image thumbnail size is 100 x 100 but I do not know why wordpress sometimes not cut according to the standard I need. Usually I have to use the new timthumb.php for this section is to use this functionality.
As part parameter “class” I’m not saying you’ll know what it do, right?
In case you want to use in addition to three standard sizes that you declare as follows:
if (function_exists ('add_theme_support')) {
add_theme_support ('post-thumbnails');
add_image_size ('ponds-cuoi1', 170, 290, true);
add_image_size ('ponds-cuoi2', 40, 40, true);
}
This code is the code to create thumbnail declaration at the beginning of this article I have introduced but added two new command line. Now have 3 standard website, not 3 anymore. When you upload one picture on the internet it will be cropped into 5 different size for 5 of this standard, if the image is smaller than the standard, there is no standard measurement photos. To call out this image, you use the following code:
<?php
if(has_post_thumbnail()) the_post_thumbnail('ao-cuoi1', array('class' => 'thumb'))
?>
That’s it, you code a try is not easy, you try it. This way, the browser does not have to use code to crop images when processing download but can have nhuot in the is to create multiple files to your storage capacity increases. But when using timthumb.php has many problems such as: do not display images, photo images.
For example, the site you are using does not have 2 standard thumbnail bad just above declaration, but now you declare previous images do not have 2 standards you have to declare? so how?
In the following article I will guide you to create the image at first without the second standard image.