WordPress.org

Make WordPress Core

Ticket #21130: 21130.4.patch

File 21130.4.patch, 1.3 KB (added by georgestephanis, 22 months ago)

Better to save the result as $custom_header than calling get_custom_header() four times?

  • wp-admin/custom-header.php

     
    510510        <?php if ( $this->admin_image_div_callback ) { 
    511511          call_user_func( $this->admin_image_div_callback ); 
    512512        } else { 
     513                $custom_header = get_custom_header(); 
     514                $header_image_style = 'background-image:url(' . esc_url( get_header_image() ) . ');'; 
     515                if ( $custom_header->width ) 
     516                        $header_image_style .= 'max-width:' . $custom_header->width . 'px;'; 
     517                if ( $custom_header->height ) 
     518                        $header_image_style .= 'height:' . $custom_header->height . 'px;'; 
    513519        ?> 
    514         <div id="headimg" style="background-image:url(<?php esc_url ( header_image() ) ?>);max-width:<?php echo get_custom_header()->width; ?>px;height:<?php echo get_custom_header()->height; ?>px;"> 
     520        <div id="headimg" style="<?php echo $header_image_style; ?>"> 
    515521                <?php 
    516522                if ( display_header_text() ) 
    517523                        $style = ' style="color:#' . get_header_textcolor() . ';"'; 
  • wp-admin/css/wp-admin.dev.css

     
    46014601 
    46024602.appearance_page_custom-header #headimg { 
    46034603        border: 1px solid #DFDFDF; 
     4604        overflow: hidden; 
    46044605        width: 100%; 
    46054606} 
    46064607