Last active
August 14, 2017 21:19
-
-
Save robertstaddon/92e771026ad449fadf89b4205d597f89 to your computer and use it in GitHub Desktop.
Divi - custom featured post image size (include default WordPress blog pages)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mycustom_featured_width( ) { return 320; /* Custom featured post image width */ } | |
add_filter( 'et_pb_blog_image_width', 'mycustom_featured_width'); | |
add_filter( 'et_pb_index_blog_image_width', 'mycustom_featured_width'); | |
function mycustom_featured_height( ) { return 260; /* Custom featured post image height */ } | |
add_filter( 'et_pb_blog_image_height', 'mycustom_featured_height'); | |
add_filter( 'et_pb_index_blog_image_height', 'mycustom_featured_height'); | |
function mycustom_featured_size( $image_sizes ) { | |
$custom_size = mycustom_featured_width() . 'x' . mycustom_featured_height(); | |
$image_sizes[$custom_size] = 'et-pb-post-main-image-thumbnail'; | |
return $image_sizes; | |
} | |
add_filter( 'et_theme_image_sizes', 'mycustom_featured_size' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment