Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Set blog, index, archive & post thumbnail sizes
*/
/* Blog */
function wpt_blog_thumbnail_width( $width ) {
return 150; //blog thumbnail width in pixels
}
add_filter( 'et_pb_blog_image_width', 'wpt_blog_thumbnail_width');
function wpt_blog_thumbnail_height( $height ) {
return 150; //blog thumbnail height in pixels
}
add_filter( 'et_pb_blog_image_height', 'wpt_blog_thumbnail_height');
/* Index & archive */
function wpt_index_thumbnail_width( $width ) {
if( !is_single() ) {
return 150; //index thumbnail width in pixels
} else {
return $width;
}
}
add_filter( 'et_pb_index_blog_image_width', 'wpt_index_thumbnail_width');
function wpt_index_thumbnail_height( $height ) {
if( !is_single() ) {
return 150; //index thumbnail height in pixels
} else {
return $height;
}
}
add_filter( 'et_pb_index_blog_image_height', 'wpt_index_thumbnail_height');
/* Post */
function wpt_post_thumbnail_width( $width ) {
if( is_single() ) {
return 300; //post thumbnail width in pixels
} else {
return $width;
}
}
add_filter( 'et_pb_index_blog_image_width', 'wpt_post_thumbnail_width');
function wpt_post_thumbnail_height( $height ) {
if( is_single() ) {
return 300; //post thumbnail height in pixels
} else {
return $height;
}
}
add_filter( 'et_pb_index_blog_image_height', 'wpt_post_thumbnail_height');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.