Creating your own image size on Wordpress
Creating your own image size in WordPress is really simple. You can add the code to the functions.php of my previous tutorial which is Creating word press from scratch.
Under the functions.php
Now we would setup the image name and size of our image so WordPress would know what would be the size and how to call our image.
add_image_size( 'ownimagesize', 960, 489, true );
ownimagesize would be the name of the image that you would call on your loop when displaying. 960 would be the image width and 489 would be the height of the image. This 3 parts can be change depending on your needs.
loop.php or any part where you want to call your own image size.
Below code is how to display your image, you would see that i called “ownimagesize” because that is the name of our image on our functions.php
wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'ownimagesize')
4 Responses to “Creating your own image size on WordPress”
Leave a Reply
Hi! Romeo is Web Developer for 7 years now.Currently i focused more on CMS based projects most of the time Wordpress and its different premium templates like Genesis and Thesis.
I love travelling during Saturdays and Sundays when got no works to removed stress when mondays come to start working again.