93
93
public function help() {
94
get_current_screen()->add_help_tab( array(
96
'title' => __('Overview'),
98
'<p>' . __( 'This screen is used to customize the header section of your theme.') . '</p>' .
99
'<p>' . __( 'You can choose from the theme’s default header images, or use one of your own. You can also customize how your Site Title and Tagline are displayed.') . '<p>'
102
get_current_screen()->add_help_tab( array(
103
'id' => 'set-header-image',
104
'title' => __('Header Image'),
106
'<p>' . __( 'You can set a custom image header for your site. Simply upload the image and crop it, and the new header will go live immediately. Alternatively, you can use an image that has already been uploaded to your Media Library by clicking the “Choose Image” button.' ) . '</p>' .
107
'<p>' . __( 'Some themes come with additional header images bundled. If you see multiple images displayed, select the one you’d like and click the “Save Changes” button.' ) . '</p>' .
108
'<p>' . __( 'If your theme has more than one default header image, or you have uploaded more than one custom header image, you have the option of having WordPress display a randomly different image on each page of your site. Click the “Random” radio button next to the Uploaded Images or Default Images section to enable this feature.') . '</p>' .
109
'<p>' . __( 'If you don’t want a header image to be displayed on your site at all, click the “Remove Header Image” button at the bottom of the Header Image section of this page. If you want to re-enable the header image later, you just have to select one of the other image options and click “Save Changes”.') . '</p>'
112
get_current_screen()->add_help_tab( array(
113
'id' => 'set-header-text',
114
'title' => __('Header Text'),
116
'<p>' . sprintf( __( 'For most themes, the header text is your Site Title and Tagline, as defined in the <a href="%1$s">General Settings</a> section.' ), admin_url( 'options-general.php' ) ) . '<p>' .
117
'<p>' . __( 'In the Header Text section of this page, you can choose whether to display this text or hide it. You can also choose a color for the text by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. “#ff0000” for red, or by choosing a color using the color picker.' ) . '</p>' .
118
'<p>' . __( 'Don’t forget to click “Save Changes” when you’re done!') . '</p>'
94
get_current_screen()->add_help_tab(
97
'title' => __( 'Overview' ),
99
'<p>' . __( 'This screen is used to customize the header section of your theme.' ) . '</p>' .
100
'<p>' . __( 'You can choose from the theme’s default header images, or use one of your own. You can also customize how your Site Title and Tagline are displayed.' ) . '<p>',
104
get_current_screen()->add_help_tab(
106
'id' => 'set-header-image',
107
'title' => __( 'Header Image' ),
109
'<p>' . __( 'You can set a custom image header for your site. Simply upload the image and crop it, and the new header will go live immediately. Alternatively, you can use an image that has already been uploaded to your Media Library by clicking the “Choose Image” button.' ) . '</p>' .
110
'<p>' . __( 'Some themes come with additional header images bundled. If you see multiple images displayed, select the one you’d like and click the “Save Changes” button.' ) . '</p>' .
111
'<p>' . __( 'If your theme has more than one default header image, or you have uploaded more than one custom header image, you have the option of having WordPress display a randomly different image on each page of your site. Click the “Random” radio button next to the Uploaded Images or Default Images section to enable this feature.' ) . '</p>' .
112
'<p>' . __( 'If you don’t want a header image to be displayed on your site at all, click the “Remove Header Image” button at the bottom of the Header Image section of this page. If you want to re-enable the header image later, you just have to select one of the other image options and click “Save Changes”.' ) . '</p>',
116
get_current_screen()->add_help_tab(
118
'id' => 'set-header-text',
119
'title' => __( 'Header Text' ),
121
'<p>' . sprintf( __( 'For most themes, the header text is your Site Title and Tagline, as defined in the <a href="%1$s">General Settings</a> section.' ), admin_url( 'options-general.php' ) ) . '<p>' .
122
'<p>' . __( 'In the Header Text section of this page, you can choose whether to display this text or hide it. You can also choose a color for the text by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. “#ff0000” for red, or by choosing a color using the color picker.' ) . '</p>' .
123
'<p>' . __( 'Don’t forget to click “Save Changes” when you’re done!' ) . '</p>',
121
127
get_current_screen()->set_help_sidebar(
122
128
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
447
465
public function step_1() {
448
466
$this->process_default_headers();
451
469
<div class="wrap">
452
470
<h1><?php _e( 'Custom Header' ); ?></h1>
454
<?php if ( current_user_can( 'customize' ) ) { ?>
472
<?php if ( current_user_can( 'customize' ) ) { ?>
455
473
<div class="notice notice-info hide-if-no-customize">
459
__( 'You can now manage and live-preview Custom Header in the <a href="%1$s">Customizer</a>.' ),
460
admin_url( 'customize.php?autofocus[control]=header_image' )
477
__( 'You can now manage and live-preview Custom Header in the <a href="%1$s">Customizer</a>.' ),
478
admin_url( 'customize.php?autofocus[control]=header_image' )
467
<?php if ( ! empty( $this->updated ) ) { ?>
485
<?php if ( ! empty( $this->updated ) ) { ?>
468
486
<div id="message" class="updated">
469
487
<p><?php printf( __( 'Header updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p>
473
491
<h3><?php _e( 'Header Image' ); ?></h3>
475
493
<table class="form-table">
478
<?php if ( get_custom_header() || display_header_text() ) : ?>
496
<?php if ( get_custom_header() || display_header_text() ) : ?>
480
498
<th scope="row"><?php _e( 'Preview' ); ?></th>
483
if ( $this->admin_image_div_callback ) {
484
call_user_func( $this->admin_image_div_callback );
486
$custom_header = get_custom_header();
487
$header_image = get_header_image();
489
if ( $header_image ) {
490
$header_image_style = 'background-image:url(' . esc_url( $header_image ) . ');';
492
$header_image_style = '';
495
if ( $custom_header->width )
496
$header_image_style .= 'max-width:' . $custom_header->width . 'px;';
497
if ( $custom_header->height )
498
$header_image_style .= 'height:' . $custom_header->height . 'px;';
501
if ( $this->admin_image_div_callback ) {
502
call_user_func( $this->admin_image_div_callback );
504
$custom_header = get_custom_header();
505
$header_image = get_header_image();
507
if ( $header_image ) {
508
$header_image_style = 'background-image:url(' . esc_url( $header_image ) . ');';
510
$header_image_style = '';
513
if ( $custom_header->width ) {
514
$header_image_style .= 'max-width:' . $custom_header->width . 'px;';
516
if ( $custom_header->height ) {
517
$header_image_style .= 'height:' . $custom_header->height . 'px;';
500
520
<div id="headimg" style="<?php echo $header_image_style; ?>">
502
if ( display_header_text() )
503
$style = ' style="color:#' . get_header_textcolor() . ';"';
505
$style = ' style="display:none;"';
507
<h1><a id="name" class="displaying-header-text" <?php echo $style; ?> onclick="return false;" href="<?php bloginfo('url'); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
522
if ( display_header_text() ) {
523
$style = ' style="color:#' . get_header_textcolor() . ';"';
525
$style = ' style="display:none;"';
528
<h1><a id="name" class="displaying-header-text" <?php echo $style; ?> onclick="return false;" href="<?php bloginfo( 'url' ); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
508
529
<div id="desc" class="displaying-header-text" <?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
515
<?php if ( current_user_can( 'upload_files' ) && current_theme_supports( 'custom-header', 'uploads' ) ) : ?>
536
<?php if ( current_user_can( 'upload_files' ) && current_theme_supports( 'custom-header', 'uploads' ) ) : ?>
517
538
<th scope="row"><?php _e( 'Select Image' ); ?></th>
519
540
<p><?php _e( 'You can select an image to be shown at the top of your site by uploading from your computer or choosing from your media library. After selecting an image you will be able to crop it.' ); ?><br />
521
if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) {
522
printf( __( 'Images of exactly <strong>%1$d × %2$d pixels</strong> will be used as-is.' ) . '<br />', get_theme_support( 'custom-header', 'width' ), get_theme_support( 'custom-header', 'height' ) );
523
} elseif ( current_theme_supports( 'custom-header', 'flex-height' ) ) {
524
if ( ! current_theme_supports( 'custom-header', 'flex-width' ) )
526
/* translators: %s: size in pixels */
527
__( 'Images should be at least %s wide.' ) . ' ',
529
/* translators: %d: custom header width */
530
'<strong>' . __( '%d pixels' ) . '</strong>',
531
get_theme_support( 'custom-header', 'width' )
534
} elseif ( current_theme_supports( 'custom-header', 'flex-width' ) ) {
535
if ( ! current_theme_supports( 'custom-header', 'flex-height' ) )
537
/* translators: %s: size in pixels */
538
__( 'Images should be at least %s tall.' ) . ' ',
540
/* translators: %d: custom header height */
541
'<strong>' . __( '%d pixels' ) . '</strong>',
542
get_theme_support( 'custom-header', 'height' )
546
if ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) {
547
if ( current_theme_supports( 'custom-header', 'width' ) )
549
/* translators: %s: size in pixels */
550
__( 'Suggested width is %s.' ) . ' ',
552
/* translators: %d: custom header width */
553
'<strong>' . __( '%d pixels' ) . '</strong>',
554
get_theme_support( 'custom-header', 'width' )
557
if ( current_theme_supports( 'custom-header', 'height' ) )
559
/* translators: %s: size in pixels */
560
__( 'Suggested height is %s.' ) . ' ',
562
/* translators: %d: custom header height */
563
'<strong>' . __( '%d pixels' ) . '</strong>',
564
get_theme_support( 'custom-header', 'height' )
569
<form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="<?php echo esc_url( add_query_arg( 'step', 2 ) ) ?>">
542
if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) {
543
printf( __( 'Images of exactly <strong>%1$d × %2$d pixels</strong> will be used as-is.' ) . '<br />', get_theme_support( 'custom-header', 'width' ), get_theme_support( 'custom-header', 'height' ) );
544
} elseif ( current_theme_supports( 'custom-header', 'flex-height' ) ) {
545
if ( ! current_theme_supports( 'custom-header', 'flex-width' ) ) {
547
/* translators: %s: size in pixels */
548
__( 'Images should be at least %s wide.' ) . ' ',
550
/* translators: %d: custom header width */
551
'<strong>' . __( '%d pixels' ) . '</strong>',
552
get_theme_support( 'custom-header', 'width' )
556
} elseif ( current_theme_supports( 'custom-header', 'flex-width' ) ) {
557
if ( ! current_theme_supports( 'custom-header', 'flex-height' ) ) {
559
/* translators: %s: size in pixels */
560
__( 'Images should be at least %s tall.' ) . ' ',
562
/* translators: %d: custom header height */
563
'<strong>' . __( '%d pixels' ) . '</strong>',
564
get_theme_support( 'custom-header', 'height' )
569
if ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) {
570
if ( current_theme_supports( 'custom-header', 'width' ) ) {
572
/* translators: %s: size in pixels */
573
__( 'Suggested width is %s.' ) . ' ',
575
/* translators: %d: custom header width */
576
'<strong>' . __( '%d pixels' ) . '</strong>',
577
get_theme_support( 'custom-header', 'width' )
581
if ( current_theme_supports( 'custom-header', 'height' ) ) {
583
/* translators: %s: size in pixels */
584
__( 'Suggested height is %s.' ) . ' ',
586
/* translators: %d: custom header height */
587
'<strong>' . __( '%d pixels' ) . '</strong>',
588
get_theme_support( 'custom-header', 'height' )
595
<form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="<?php echo esc_url( add_query_arg( 'step', 2 ) ); ?>">
571
597
<label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br />
572
598
<input type="file" id="upload" name="import" />
573
599
<input type="hidden" name="action" value="save" />
574
<?php wp_nonce_field( 'custom-header-upload', '_wpnonce-custom-header-upload' ); ?>
575
<?php submit_button( __( 'Upload' ), '', 'submit', false ); ?>
600
<?php wp_nonce_field( 'custom-header-upload', '_wpnonce-custom-header-upload' ); ?>
601
<?php submit_button( __( 'Upload' ), '', 'submit', false ); ?>
578
$modal_update_href = esc_url( add_query_arg( array(
579
'page' => 'custom-header',
581
'_wpnonce-custom-header-upload' => wp_create_nonce('custom-header-upload'),
582
), admin_url('themes.php') ) );
604
$modal_update_href = esc_url(
607
'page' => 'custom-header',
609
'_wpnonce-custom-header-upload' => wp_create_nonce( 'custom-header-upload' ),
611
admin_url( 'themes.php' )
585
616
<label for="choose-from-library-link"><?php _e( 'Or choose an image from your media library:' ); ?></label><br />
586
617
<button id="choose-from-library-link" class="button"
598
<form method="post" action="<?php echo esc_url( add_query_arg( 'step', 1 ) ) ?>">
599
<?php submit_button( null, 'screen-reader-text', 'save-header-options', false ); ?>
629
<form method="post" action="<?php echo esc_url( add_query_arg( 'step', 1 ) ); ?>">
630
<?php submit_button( null, 'screen-reader-text', 'save-header-options', false ); ?>
600
631
<table class="form-table">
602
<?php if ( get_uploaded_header_images() ) : ?>
633
<?php if ( get_uploaded_header_images() ) : ?>
604
635
<th scope="row"><?php _e( 'Uploaded Images' ); ?></th>
606
<p><?php _e( 'You can choose one of your previously uploaded headers, or show a random one.' ) ?></p>
608
$this->show_header_selector( 'uploaded' );
637
<p><?php _e( 'You can choose one of your previously uploaded headers, or show a random one.' ); ?></p>
639
$this->show_header_selector( 'uploaded' );
613
if ( ! empty( $this->default_headers ) ) : ?>
645
if ( ! empty( $this->default_headers ) ) :
615
648
<th scope="row"><?php _e( 'Default Images' ); ?></th>
617
<?php if ( current_theme_supports( 'custom-header', 'uploads' ) ) : ?>
618
<p><?php _e( 'If you don‘t want to upload your own image, you can use one of these cool headers, or show a random one.' ) ?></p>
620
<p><?php _e( 'You can use one of these cool headers or show a random one on each page.' ) ?></p>
623
$this->show_header_selector( 'default' );
650
<?php if ( current_theme_supports( 'custom-header', 'uploads' ) ) : ?>
651
<p><?php _e( 'If you don‘t want to upload your own image, you can use one of these cool headers, or show a random one.' ); ?></p>
653
<p><?php _e( 'You can use one of these cool headers or show a random one on each page.' ); ?></p>
656
$this->show_header_selector( 'default' );
628
if ( get_header_image() ) : ?>
662
if ( get_header_image() ) :
630
665
<th scope="row"><?php _e( 'Remove Image' ); ?></th>
632
<p><?php _e( 'This will remove the header image. You will not be able to restore any customizations.' ) ?></p>
633
<?php submit_button( __( 'Remove Header Image' ), '', 'removeheader', false ); ?>
667
<p><?php _e( 'This will remove the header image. You will not be able to restore any customizations.' ); ?></p>
668
<?php submit_button( __( 'Remove Header Image' ), '', 'removeheader', false ); ?>
638
$default_image = sprintf( get_theme_support( 'custom-header', 'default-image' ), get_template_directory_uri(), get_stylesheet_directory_uri() );
639
if ( $default_image && get_header_image() != $default_image ) : ?>
674
$default_image = sprintf( get_theme_support( 'custom-header', 'default-image' ), get_template_directory_uri(), get_stylesheet_directory_uri() );
675
if ( $default_image && get_header_image() != $default_image ) :
641
678
<th scope="row"><?php _e( 'Reset Image' ); ?></th>
643
<p><?php _e( 'This will restore the original header image. You will not be able to restore any customizations.' ) ?></p>
644
<?php submit_button( __( 'Restore Original Header Image' ), '', 'resetheader', false ); ?>
680
<p><?php _e( 'This will restore the original header image. You will not be able to restore any customizations.' ); ?></p>
681
<?php submit_button( __( 'Restore Original Header Image' ), '', 'resetheader', false ); ?>
651
<?php if ( current_theme_supports( 'custom-header', 'header-text' ) ) : ?>
688
<?php if ( current_theme_supports( 'custom-header', 'header-text' ) ) : ?>
653
690
<h3><?php _e( 'Header Text' ); ?></h3>
667
704
<th scope="row"><?php _e( 'Text Color' ); ?></th>
672
if ( current_theme_supports( 'custom-header', 'default-text-color' ) ) {
673
$default_color = get_theme_support( 'custom-header', 'default-text-color' );
674
if ( $default_color && false === strpos( $default_color, '#' ) ) {
675
$default_color = '#' . $default_color;
679
$default_color_attr = $default_color ? ' data-default-color="' . esc_attr( $default_color ) . '"' : '';
681
$header_textcolor = display_header_text() ? get_header_textcolor() : get_theme_support( 'custom-header', 'default-text-color' );
682
if ( $header_textcolor && false === strpos( $header_textcolor, '#' ) ) {
683
$header_textcolor = '#' . $header_textcolor;
686
echo '<input type="text" name="text-color" id="text-color" value="' . esc_attr( $header_textcolor ) . '"' . $default_color_attr . ' />';
687
if ( $default_color ) {
688
echo ' <span class="description hide-if-js">' . sprintf( _x( 'Default: %s', 'color' ), esc_html( $default_color ) ) . '</span>';
709
if ( current_theme_supports( 'custom-header', 'default-text-color' ) ) {
710
$default_color = get_theme_support( 'custom-header', 'default-text-color' );
711
if ( $default_color && false === strpos( $default_color, '#' ) ) {
712
$default_color = '#' . $default_color;
716
$default_color_attr = $default_color ? ' data-default-color="' . esc_attr( $default_color ) . '"' : '';
718
$header_textcolor = display_header_text() ? get_header_textcolor() : get_theme_support( 'custom-header', 'default-text-color' );
719
if ( $header_textcolor && false === strpos( $header_textcolor, '#' ) ) {
720
$header_textcolor = '#' . $header_textcolor;
723
echo '<input type="text" name="text-color" id="text-color" value="' . esc_attr( $header_textcolor ) . '"' . $default_color_attr . ' />';
724
if ( $default_color ) {
725
echo ' <span class="description hide-if-js">' . sprintf( _x( 'Default: %s', 'color' ), esc_html( $default_color ) ) . '</span>';
699
* Fires just before the submit button in the custom header options form.
703
do_action( 'custom_header_options' );
705
wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
707
<?php submit_button( null, 'primary', 'save-header-options' ); ?>
737
* Fires just before the submit button in the custom header options form.
741
do_action( 'custom_header_options' );
743
wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' );
746
<?php submit_button( null, 'primary', 'save-header-options' ); ?>
714
754
* Display second step of custom header image page.
728
768
if ( empty( $_POST ) && isset( $_GET['file'] ) ) {
729
769
$attachment_id = absint( $_GET['file'] );
730
$file = get_attached_file( $attachment_id, true );
731
$url = wp_get_attachment_image_src( $attachment_id, 'full' );
770
$file = get_attached_file( $attachment_id, true );
771
$url = wp_get_attachment_image_src( $attachment_id, 'full' );
733
773
} elseif ( isset( $_POST ) ) {
734
$data = $this->step_2_manage_upload();
774
$data = $this->step_2_manage_upload();
735
775
$attachment_id = $data['attachment_id'];
736
$file = $data['file'];
776
$file = $data['file'];
740
780
if ( file_exists( $file ) ) {
741
781
list( $width, $height, $type, $attr ) = getimagesize( $file );
743
$data = wp_get_attachment_metadata( $attachment_id );
744
$height = isset( $data[ 'height' ] ) ? $data[ 'height' ] : 0;
745
$width = isset( $data[ 'width' ] ) ? $data[ 'width' ] : 0;
783
$data = wp_get_attachment_metadata( $attachment_id );
784
$height = isset( $data['height'] ) ? $data['height'] : 0;
785
$width = isset( $data['width'] ) ? $data['width'] : 0;
750
790
// For flex, limit size of image displayed to 1500px unless theme says otherwise
751
if ( current_theme_supports( 'custom-header', 'flex-width' ) )
791
if ( current_theme_supports( 'custom-header', 'flex-width' ) ) {
752
792
$max_width = 1500;
754
if ( current_theme_supports( 'custom-header', 'max-width' ) )
795
if ( current_theme_supports( 'custom-header', 'max-width' ) ) {
755
796
$max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) );
756
798
$max_width = max( $max_width, get_theme_support( 'custom-header', 'width' ) );
758
800
// If flexible height isn't supported and the image is the exact right size
759
801
if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' )
760
&& $width == get_theme_support( 'custom-header', 'width' ) && $height == get_theme_support( 'custom-header', 'height' ) )
802
&& $width == get_theme_support( 'custom-header', 'width' ) && $height == get_theme_support( 'custom-header', 'height' ) ) {
762
803
// Add the meta-data
763
if ( file_exists( $file ) )
804
if ( file_exists( $file ) ) {
764
805
wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
766
808
$this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) );
894
940
if ( $_POST['oitar'] > 1 ) {
895
$_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
896
$_POST['y1'] = $_POST['y1'] * $_POST['oitar'];
897
$_POST['width'] = $_POST['width'] * $_POST['oitar'];
941
$_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
942
$_POST['y1'] = $_POST['y1'] * $_POST['oitar'];
943
$_POST['width'] = $_POST['width'] * $_POST['oitar'];
898
944
$_POST['height'] = $_POST['height'] * $_POST['oitar'];
901
947
$attachment_id = absint( $_POST['attachment_id'] );
902
$original = get_attached_file($attachment_id);
904
$dimensions = $this->get_header_dimensions( array(
905
'height' => $_POST['height'],
906
'width' => $_POST['width'],
908
$height = $dimensions['dst_height'];
909
$width = $dimensions['dst_width'];
911
if ( empty( $_POST['skip-cropping'] ) )
948
$original = get_attached_file( $attachment_id );
950
$dimensions = $this->get_header_dimensions(
952
'height' => $_POST['height'],
953
'width' => $_POST['width'],
956
$height = $dimensions['dst_height'];
957
$width = $dimensions['dst_width'];
959
if ( empty( $_POST['skip-cropping'] ) ) {
912
960
$cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $width, $height );
913
elseif ( ! empty( $_POST['create-new-attachment'] ) )
961
} elseif ( ! empty( $_POST['create-new-attachment'] ) ) {
914
962
$cropped = _copy_image_file( $attachment_id );
916
964
$cropped = get_attached_file( $attachment_id );
918
if ( ! $cropped || is_wp_error( $cropped ) )
967
if ( ! $cropped || is_wp_error( $cropped ) ) {
919
968
wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
921
971
/** This filter is documented in wp-admin/custom-header.php */
922
972
$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication
924
974
$object = $this->create_attachment_object( $cropped, $attachment_id );
926
if ( ! empty( $_POST['create-new-attachment'] ) )
976
if ( ! empty( $_POST['create-new-attachment'] ) ) {
927
977
unset( $object['ID'] );
929
980
// Update the attachment
930
981
$attachment_id = $this->insert_attachment( $object, $cropped );