| 1962 | | $this->add_control( new WP_Customize_Media_Control( $this, 'custom_logo', array( |
| 1963 | | 'label' => __( 'Logo' ), |
| 1964 | | 'section' => 'title_tagline', |
| 1965 | | 'priority' => 8, |
| 1966 | | 'mime_type' => 'image', |
| | 1964 | // Get custom logo settings and extend defaults with it. |
| | 1965 | $custom_logo_args = get_theme_support( 'custom-logo' ); |
| | 1966 | $custom_logo_args = (array) $custom_logo_args[0]; |
| | 1967 | $custom_logo_control_args = array( |
| | 1968 | 'width' => false, |
| | 1969 | 'height' => false, |
| | 1970 | 'flex_width' => true, |
| | 1971 | 'flex_height' => true, |
| | 1972 | ); |
| | 1973 | $custom_logo_control_args = wp_parse_args( array_intersect_key( $custom_logo_args, $custom_logo_control_args ), $custom_logo_control_args ); |
| | 1974 | |
| | 1975 | // If no width/height were defined but there is a custom image size, use that. |
| | 1976 | if ( ! empty( $custom_logo_args['size'] ) && has_image_size( $custom_logo_args['size'] ) && ! $custom_logo_control_args['width'] && ! $custom_logo_control_args['height'] ) { |
| | 1977 | global $_wp_additional_image_sizes; |
| | 1978 | $custom_logo_size = $custom_logo_args['size']; |
| | 1979 | |
| | 1980 | $custom_logo_control_args['width'] = $_wp_additional_image_sizes[ $custom_logo_size ]['width']; |
| | 1981 | $custom_logo_control_args['height'] = $_wp_additional_image_sizes[ $custom_logo_size ]['height']; |
| | 1982 | $custom_logo_control_args['flex_width'] = empty( $_wp_additional_image_sizes[ $custom_logo_size ]['crop'] ); |
| | 1983 | $custom_logo_control_args['flex_height'] = empty( $_wp_additional_image_sizes[ $custom_logo_size ]['crop'] ); |
| | 1984 | } |
| | 1985 | |
| | 1986 | $custom_logo_control_args = wp_parse_args( $custom_logo_control_args, array( |
| | 1987 | 'label' => __( 'Logo' ), |
| | 1988 | 'section' => 'title_tagline', |
| | 1989 | 'priority' => 8, |