WordPress.org

Make WordPress Core

Ticket #21100: custom-header-21100-madtownlems.diff

File custom-header-21100-madtownlems.diff, 1.1 KB (added by MadtownLems, 6 years ago)

patch for ticket 21100 - hide "skip crop" button when flex headers not in use

  • wp-admin/custom-header.php

     
    767767        <p class="submit">
    768768        <?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?>
    769769        <?php
    770         if ( isset( $oitar ) && 1 == $oitar )
     770        if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
    771771                submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false );
    772772        ?>
    773773        </p>
     
    819819                if ( ! current_theme_supports( 'custom-header', 'uploads' ) )
    820820                        wp_die( __( 'Cheatin&#8217; uh?' ) );
    821821
     822                if ( ! empty( $_POST['skip-cropping'] ) && ! ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
     823                        wp_die( __( 'Cheatin&#8217; uh?' ) );
     824                       
    822825                if ( $_POST['oitar'] > 1 ) {
    823826                        $_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
    824827                        $_POST['y1'] = $_POST['y1'] * $_POST['oitar'];