Viewing 2 replies - 1 through 2 (of 2 total)
  • I wrote a fix, so that the srcset functionality is available.

    In wp-display-header.php add this line in the method init()
    $this->hook( 'theme_mod_header_image_data' );
    and add this method:

    public function theme_mod_header_image_data($header_image_data)
    {
    	if (is_category() OR is_tag() OR is_tax())
    		$active_header = $this->get_active_tax_header();
    	else if (is_author())
    		$active_header = $this->get_active_author_header();
    	else if (is_singular())
    		$active_header = $this->get_active_post_header();
    
    	if (isset($active_header) AND $active_header)
    	{
    		$_uploaded_header_images = get_uploaded_header_images();
    		foreach ($_uploaded_header_images as $id => $data)
    		{
    			if ($data['url'] == $active_header)
    			{
    				$header_image_data = $data;
    				break;
    			}
    		}
    	}
    
    	return $header_image_data;
    }
    • This reply was modified 8 years, 2 months ago by jarvis3008.

    I had to modify the fix because the current/active header image URL wasn’t containing the hostname while the URLs in header image data array do, so also trying to match the URL inside the other:

    if (($data['url'] == $active_header) or strpos($data['url'], $active_header) !== false)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘No longer works with srcset’ is closed to new replies.