views/noticias/wp-content/themes/ts-photography/inc/logo/logo-resizer.php
/**
 * Add support for logo resizing by filtering `get_custom_logo`
 */
Add support for logo resizing by filtering `get_custom_logo`
Add support for logo resizing by filtering ` get_custom_logo `
function ts_photography_customize_logo_resize( $html ) {
	$size = get_theme_mod( 'logo_size' );
	$custom_logo_id = get_theme_mod( 'custom_logo' );
	$min = 48;
	if ( is_numeric( $size ) && is_numeric( $custom_logo_id ) ) {
		$logo = wp_get_attachment_metadata( $custom_logo_id );
		if ( ! $logo ) return $html;
		$sizes = get_theme_support( 'custom-logo' );
		$max['height'] = isset( $sizes[0]['height'] ) ? $sizes[0]['height'] : $logo['height'];
		$max['width'] = isset( $sizes[0]['width'] ) ? $sizes[0]['width'] : $logo['width'];
		if ( $logo['width'] >= $logo['height'] ) {
			$output = ts_photography_min_max( $logo['height'], $logo['width'], $max['height'], $max['width'], $size, $min );
			$img = array(
				'height'	=> $output['short'],
				'width'		=> $output['long']
			);
		} else if ( $logo['width'] < $logo['height'] ) {
			$output = ts_photography_min_max( $logo['width'], $logo['height'], $max['width'], $max['height'], $size, $min );
			$img = array(
				'height'	=> $output['long'],
				'width'		=> $output['short']
			);
		}
		$css = '
<style>
.custom-logo {
	height: ' . $img['height'] . 'px;
	max-height: ' . $max['height'] . 'px;
	max-width: ' . $max['width'] . 'px;
	width: ' . $img['width'] . 'px;
}
</style>';
		$html = $css . $html;
	}
	return $html;
}
function ts_photography_customize_logo_resize ( $ html ) { $ size = get_theme_mod ( 'logo_size' ) ; $ custom_logo_id = get_theme_mod ( 'custom_logo' ) ; $ min = 48 ; if ( is_numeric ( $ size ) && is_numeric ( $ custom_logo_id ) ) { $ logo = wp_get_attachment_metadata ( $ custom_logo_id ) ; if ( ! $ logo ) return $ html ; $ sizes = get_theme_support ( 'custom-logo' ) ; $ max [ 'height' ] = isset ( $ sizes [ 0 ] [ 'height' ] ) ? $ sizes [ 0 ] [ 'height' ] : $ logo [ 'height' ] ; $ max [ 'width' ] = isset ( $ sizes [ 0 ] [ 'width' ] ) ? $ sizes [ 0 ] [ 'width' ] : $ logo [ 'width' ] ; if ( $ logo [ 'width' ] >= $ logo [ 'height' ] ) { $ output = ts_photography_min_max ( $ logo [ 'height' ] , $ logo [ 'width' ] , $ max [ 'height' ] , $ max [ 'width' ] , $ size , $ min ) ; $ img = array ( 'height' => $ output [ 'short' ] , 'width' => $ output [ 'long' ] ) ; } else if ( $ logo [ 'width' ] < $ logo [ 'height' ] ) { $ output = ts_photography_min_max ( $ logo [ 'width' ] , $ logo [ 'height' ] , $ max [ 'width' ] , $ max [ 'height' ] , $ size , $ min ) ; $ img = array ( 'height' => $ output [ 'long' ] , 'width' => $ output [ 'short' ] ) ; } $ css = '
<style>
.custom-logo {
	height: ' . $ img [ 'height' ] . 'px;
	max-height: ' . $ max [ 'height' ] . 'px;
	max-width: ' . $ max [ 'width' ] . 'px;
	width: ' . $ img [ 'width' ] . 'px;
}
</style>' ; $ html = $ css . $ html ; } return $ html ; }
Add support for logo resizing by filtering `get_custom_logo`
Add support for logo resizing by filtering ` get_custom_logo `
// set the short side minimum // don't use empty() because we can still use a 0 // we're looking for $img['width'] and $img['height'] of original image // get the logo support size // Check for max height and width, default to image sizes if none set in theme // landscape or square // portrait // add the CSS