[Resolved] Header Element Page Hero Background Featured Image Size

Home Forums Support [Resolved] Header Element Page Hero Background Featured Image Size

Home Forums Support Header Element Page Hero Background Featured Image Size

  • This topic has 3 replies, 2 voices, and was last updated 5 years ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #860975
    Marcus

    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.

    #860982
    David
    Staff
    Customer Support

    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.

    #861013
    Marcus

    Thank you David… that makes sense. I appreciate the reply!

    #861198
    David
    Staff
    Customer Support

    Glad to be of help.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.