WordPress.org

Make WordPress Core

Ticket #21100: 21100.diff

File 21100.diff, 3.4 KB (added by kobenland, 6 years ago)

This is what I came up with: Only display skip crop button, wenn flex-width or height are supported

  • wp-admin/custom-header.php

     
    742742                ?>
    743743
    744744<div class="wrap">
    745 <?php screen_icon(); ?>
    746 <h2><?php _e( 'Crop Header Image' ); ?></h2>
    747 
    748 <form method="post" action="<?php echo esc_attr(add_query_arg('step', 3)); ?>">
    749         <p class="hide-if-no-js"><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
    750         <p class="hide-if-js"><strong><?php _e( 'You need Javascript to choose a part of the image.'); ?></strong></p>
    751 
    752         <div id="crop_image" style="position: relative">
    753                 <img src="<?php echo esc_url( $url ); ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" />
    754         </div>
    755 
    756         <input type="hidden" name="x1" id="x1" value="0"/>
    757         <input type="hidden" name="y1" id="y1" value="0"/>
    758         <input type="hidden" name="width" id="width" value="<?php echo esc_attr( $width ); ?>"/>
    759         <input type="hidden" name="height" id="height" value="<?php echo esc_attr( $height ); ?>"/>
    760         <input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr( $attachment_id ); ?>" />
    761         <input type="hidden" name="oitar" id="oitar" value="<?php echo esc_attr( $oitar ); ?>" />
    762         <?php if ( empty( $_POST ) && isset( $_GET['file'] ) ) { ?>
    763         <input type="hidden" name="create-new-attachment" value="true" />
    764         <?php } ?>
    765         <?php wp_nonce_field( 'custom-header-crop-image' ) ?>
    766 
    767         <p class="submit">
    768         <?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?>
    769         <?php
    770         if ( isset( $oitar ) && 1 == $oitar )
    771                 submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false );
    772         ?>
    773         </p>
    774 </form>
     745        <?php screen_icon(); ?>
     746        <h2><?php _e( 'Crop Header Image' ); ?></h2>
     747       
     748        <form method="post" action="<?php echo esc_attr(add_query_arg('step', 3)); ?>">
     749                <p class="hide-if-no-js"><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
     750                <p class="hide-if-js"><strong><?php _e( 'You need Javascript to choose a part of the image.'); ?></strong></p>
     751       
     752                <div id="crop_image" style="position: relative">
     753                        <img src="<?php echo esc_url( $url ); ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" />
     754                </div>
     755       
     756                <input type="hidden" name="x1" id="x1" value="0"/>
     757                <input type="hidden" name="y1" id="y1" value="0"/>
     758                <input type="hidden" name="width" id="width" value="<?php echo esc_attr( $width ); ?>"/>
     759                <input type="hidden" name="height" id="height" value="<?php echo esc_attr( $height ); ?>"/>
     760                <input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr( $attachment_id ); ?>" />
     761                <input type="hidden" name="oitar" id="oitar" value="<?php echo esc_attr( $oitar ); ?>" />
     762                <?php if ( empty( $_POST ) && isset( $_GET['file'] ) ) { ?>
     763                <input type="hidden" name="create-new-attachment" value="true" />
     764                <?php } ?>
     765                <?php wp_nonce_field( 'custom-header-crop-image' ) ?>
     766       
     767                <p class="submit">
     768                <?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?>
     769                <?php
     770                if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
     771                        submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false );
     772                ?>
     773                </p>
     774        </form>
    775775</div>
    776776                <?php
    777777        }