Making WordPress.org

Changeset 1559


Ignore:
Timestamp:
05/09/2015 10:47:54 AM (10 years ago)
Author:
ocean90
Message:

Rosetta Theme: Don't fall back to deprecated "shots" if a site has no header image yet.

Make height and width flexible so you can optimize header images for HiDPI.

Location:
sites/trunk/global.wordpress.org/public_html/wp-content/themes/rosetta
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/global.wordpress.org/public_html/wp-content/themes/rosetta/functions.php

    r1476 r1559  
    66    add_theme_support( 'custom-header', array(
    77        'default-image' => false,
    8         'header-text' => false,
    9         'width' => 466,
    10         'height' => 303,
     8        'header-text'   => false,
     9        'width'         => 466,
     10        'height'        => 303,
     11        'flex-height'   => true,
     12        'flex-width'    => true,
    1113    ) );
    1214
  • sites/trunk/global.wordpress.org/public_html/wp-content/themes/rosetta/index.php

    r1060 r1559  
    2424                <h3><?php the_title(); ?></h3>
    2525
    26 <?php
    27     $hw = image_hwstring( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT );
    28     if ( ! $header_image = get_header_image() ) {
    29         $header_image = content_url( '/languages/shots/shot-' . $rosetta->locale . '.png' );
    30         $hw = '';
    31     }
    32 ?>
    33                 <img class="shot" <?php echo $hw; ?>src="<?php echo esc_url( $header_image ); ?>" alt="Localized version screenshot" />
    34                     <?php the_content(); ?>
     26                <?php
     27                if ( $header_image = get_header_image() ) {
     28                    $hw = image_hwstring( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT );
     29                    printf(
     30                        '<img class="shot" %ssrc="%s" alt="" />',
     31                        $hw,
     32                        esc_url( $header_image )
     33                    );
     34                }
     35
     36                the_content();
     37                ?>
    3538<?php endwhile; ?>
    3639            </div>
Note: See TracChangeset for help on using the changeset viewer.