Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter anomore

    (@anomore)

    Thank you man!
    I realized that my fix didn’t work well, but I didn’t have time to work on this.

    — Update —

    In my article category doesn’t appears the box for header selection.

    • This reply was modified 7 years, 11 months ago by anomore.

    The problem is Twenty Sixteen uses get_custom_header() that uses header_image_data.
    I solved the problem by changing the plugin in this way:

    File class-unique-headers-display.php:

    Add add_filter( 'theme_mod_header_image_data', array( 'Custom_Image_Meta_Box', 'header_image_data_filter' ), 20 ); after add_filter( 'theme_mod_header_image', array( $this, 'header_image_filter' ), 20 );

    File class-unique-headers-taxonomy-header-images.php:

    Add add_filter( 'theme_mod_header_image_data', array( 'Custom_Image_Meta_Box', 'header_image_data_filter' ), 5 ); after add_filter( 'theme_mod_header_image', array( $this, 'header_image_filter' ), 5 );

    File class-custom-image-meta-box.php:

    Add this static method to class:

    static function header_image_data_filter( $data ) {
    	if (!$data) return;
    
    	$url = get_header_image();
    
    	return (object) array(
    		'attachment_id' => attachment_url_to_postid($url),
    		'url'           => $url,
    		'thumbnail_url' => $url,
    		'height'        => $data->height,
    		'width'         => $data->width,
    	);
    }

    Bye!

Viewing 2 replies - 1 through 2 (of 2 total)