You appear to be a bot. Output may be restricted
Description
Get the information about the logo.
Usage
$string = twentytwenty_get_custom_logo( $html );
Parameters
- $html
- ( string ) required – The HTML output from get_custom_logo (core function).
Returns
string
Source
File name: twentytwenty/functions.php
Lines:
1 to 47 of 47
function twentytwenty_get_custom_logo( $html ) { $logo_id = get_theme_mod( 'custom_logo' ); if ( ! $logo_id ) { return $html; } $logo = wp_get_attachment_image_src( $logo_id, 'full' ); if ( $logo ) { // For clarity. $logo_width = esc_attr( $logo[1] ); $logo_height = esc_attr( $logo[2] ); // If the retina logo setting is active, reduce the width/height by half. if ( get_theme_mod( 'retina_logo', false ) ) { $logo_width = floor( $logo_width / 2 ); $logo_height = floor( $logo_height / 2 ); $search = array( '/width=\"\d+\"/iU', '/height=\"\d+\"/iU', ); $replace = array( "width=\"{$logo_width}\"", "height=\"{$logo_height}\"", ); // Add a style attribute with the height, or append the height to the style attribute if the style attribute already exists. if ( strpos( $html, ' style=' ) === false ) { $search[] = '/(src=)/'; $replace[] = "style=\"height: {$logo_height}px;\" src="; } else { $search[] = '/(style="[^"]*)/'; $replace[] = "$1 height: {$logo_height}px;"; } $html = preg_replace( $search, $replace, $html ); } } return $html; }