Archived topic
Header Element Page Hero Background Featured Image Size
3 replies · Started by Marcus on April 5, 2019
Hello good people of GeneratePress!
I'm trying have the Header Element Page Hero Featured Image background use a custom size using the code below. The Header Element is set to display on ALL pages but the home page.
However, after re-generating thumbnails, and viewing the source… the header is using the FULL SIZE featured image, instead of one of my fancy custom featured image sizes.
add_action('after_setup_theme', 'esiteful_features');
function esiteful_features() {
add_image_size('eBanner', 1500, 500, true);
add_image_size('eFeature', 840, 290, true);
add_filter( 'generate_page_header_default_size','tu_set_image_size' );
add_filter( 'image_size_names_choose', 'my_custom_sizes' );
}
function tu_set_image_size() {
return 'eBanner';
}
Any ideas or direction would be most appreciated.
Hi there,
Images in the Header Element are set as background-images using CSS. src-set images don't apply here. As a rule of thumb, as these are generally the largest images used i set my original image to suit them.
Apart from using media queries to swap the images for different device sizes there isn't an automatic fix to this.
Thank you David… that makes sense. I appreciate the reply!
Glad to be of help.