Skip to content

Instantly share code, notes, and snippets.

@TomFrearson
Last active August 14, 2016 22:31
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TomFrearson/23e42899c936656fd9bb to your computer and use it in GitHub Desktop.
Save TomFrearson/23e42899c936656fd9bb to your computer and use it in GitHub Desktop.
<?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