Skip to content

How to re define divi thumbnails size

kary4 edited this page Nov 10, 2017 · 6 revisions

If you want to change the default image size for Divi Blog Modules then add the following code to the functions.php file in your child theme folder:

function custom_et_pb_blog_image_width () {return 100;} //define your own width value
function custom_et_pb_blog_image_height () {return 100;} //define your own height value

add_filter('et_pb_blog_image_width', 'custom_et_pb_blog_image_width');
add_filter('et_pb_blog_image_height', 'custom_et_pb_blog_image_height');

to change the default image size for Divi single post pages:

function custom_et_pb_index_blog_image_width () {return 100;} //define your own width value
function custom_et_pb_index_blog_image_height () {return 100;} //define your own height value

add_filter('et_pb_index_blog_image_width', 'custom_et_pb_index_blog_image_width');
add_filter('et_pb_index_blog_image_height', 'custom_et_pb_index_blog_image_height');

to change the default image size for Divi portfolio module:

function custom_et_pb_portfolio_image_width () {return 100;} //define your own width value
function custom_et_pb_portfolio_image_height () {return 100;} //define your own height value

add_filter('et_pb_portfolio_image_width', 'custom_et_pb_portfolio_image_width');
add_filter('et_pb_portfolio_image_height', 'custom_et_pb_portfolio_image_height');

add_image_size( 'custom-portfolio-size', 765, 573, true );

to change the default image size for Divi gallery module:

function custom_et_pb_gallery_image_width () {return 400;} //define your own width value
function custom_et_pb_gallery_image_height () {return 100;} //define your own height value

add_filter('et_pb_gallery_image_width', 'custom_et_pb_gallery_image_width');
add_filter('et_pb_gallery_image_height', 'custom_et_pb_gallery_image_height');

Extra theme.

To change the default thumbnail sizes in extra theme you can add the following code to the functions.php file in you child theme folder:


function custom_extra_add_image_sizes() {
	$sizes = array(
		'extra-image-huge'          => array(
			'width'  => 1280,
			'height' => 768,
			'crop'   => true,
		),
		'extra-image-single-post'   => array(
			'width'  => 1280,
			'height' => 640,
			'crop'   => true,
		),
		'extra-image-medium'        => array(
			'width'  => 100,
			'height' => 600,
			'crop'   => true,
		),
		'extra-image-small'         => array(
			'width'  => 300,
			'height' => 300,
			'crop'   => true,
		),
		'extra-image-square-medium' => array(
			'width'  => 440,
			'height' => 440,
			'crop'   => true,
		),
		'extra-image-square-small'  => array(
			'width'  => 150,
			'height' => 150,
			'crop'   => true,
		),
	);

	foreach ( $sizes as $name => $size_info ) {
		add_image_size( $name, $size_info['width'], $size_info['height'], $size_info['crop'] );
	}
}

function redefine_extra_add_image_sizes () {
	remove_action('after_setup_theme', 'extra_add_image_sizes');
	add_action( 'after_setup_theme', 'custom_extra_add_image_sizes' );
}

add_action( 'after_setup_theme', 'redefine_extra_add_image_sizes' );
Clone this wiki locally
You can’t perform that action at this time.