Image Sizes

Category: Shortcodes (Elements) 2

Image Sizes

In some shortcodes there are image size field to input image sizes.

Following are php code which add image sizes in Porto theme.


add_image_size( 'blog-large', 1140, 445, true );
add_image_size( 'blog-medium', 463, 348, true );
add_image_size( 'blog-masonry', 640, 9999, false );
add_image_size( 'blog-masonry-small', 400, 9999, false );
add_image_size( 'blog-grid', 640, 480, true );
add_image_size( 'blog-grid-small', 400, 300, true );
add_image_size( 'related-post', ( isset( $porto_settings['post-related-image-size'] ) && (int) $porto_settings['post-related-image-size']['width'] ) ? (int) $porto_settings['post-related-image-size']['width'] : 450, ( isset( $porto_settings['post-related-image-size'] ) && (int) $porto_settings['post-related-image-size']['height'] ) ? (int) $porto_settings['post-related-image-size']['height'] : 231, true );
if ( isset( $porto_settings['enable-portfolio'] ) && $porto_settings['enable-portfolio'] ) {
	add_image_size( 'portfolio-grid-one', 1140, 595, true );
	add_image_size( 'portfolio-grid-two', 560, 560, true );
	add_image_size( 'portfolio-grid', 367, 367, true );
	add_image_size( 'portfolio-masonry', 367, 9999, false );
	add_image_size( 'portfolio-full', 1140, 595, true );
	add_image_size( 'portfolio-large', 560, 367, true );
	add_image_size( 'portfolio-medium', 367, 367, true );
	add_image_size( 'portfolio-timeline', 560, 560, true );
	add_image_size( 'related-portfolio', 367, 367, true );
	add_image_size( 'portfolio-cat-stripes', 494, 1080, true );
	add_image_size( 'portfolio-cat-parallax', 1970, 627, true );
	add_image_size( 'portfolio-thumbnail', 200, 150, true );
}

if ( isset( $porto_settings['enable-member'] ) && $porto_settings['enable-member'] ) {
	add_image_size( 'member-two', 560, 560, true );
	add_image_size( 'member', 367, 367, true );
}
add_image_size( 'widget-thumb-medium', 85, 85, true );
add_image_size( 'widget-thumb', 50, 50, true );

If fourth parameter is true in add_image_size function, images will be cropped to the specified dimensions using center positions.

Portfolio image sizes will be enabled if Portfolio Content Type is enabled in Theme Options -> Portfolio.

Member image sizes will be enabled if Member Content Type is enabled in Theme Options -> Member.

Share this post