88 'title' => __( 'Overview' ), |
88 'title' => __( 'Overview' ), |
89 'content' => |
89 'content' => |
90 '<p>' . __( 'You can customize the look of your site without touching any of your theme’s code by using a custom background. Your background can be an image or a color.' ) . '</p>' . |
90 '<p>' . __( 'You can customize the look of your site without touching any of your theme’s code by using a custom background. Your background can be an image or a color.' ) . '</p>' . |
91 '<p>' . __( 'To use a background image, simply upload it or choose an image that has already been uploaded to your Media Library by clicking the “Choose Image” button. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site.' ) . '</p>' . |
91 '<p>' . __( 'To use a background image, simply upload it or choose an image that has already been uploaded to your Media Library by clicking the “Choose Image” button. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site.' ) . '</p>' . |
92 '<p>' . __( 'You can also choose a background color 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>' . |
92 '<p>' . __( 'You can also choose a background color 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>' . |
93 '<p>' . __( 'Don’t forget to click on the Save Changes button when you are finished.' ) . '</p>', |
93 '<p>' . __( 'Do not forget to click on the Save Changes button when you are finished.' ) . '</p>', |
94 ) |
94 ) |
95 ); |
95 ); |
96 |
96 |
97 get_current_screen()->set_help_sidebar( |
97 get_current_screen()->set_help_sidebar( |
98 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
98 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
508 $url = $file['url']; |
508 $url = $file['url']; |
509 $type = $file['type']; |
509 $type = $file['type']; |
510 $file = $file['file']; |
510 $file = $file['file']; |
511 $filename = wp_basename( $file ); |
511 $filename = wp_basename( $file ); |
512 |
512 |
513 // Construct the object array. |
513 // Construct the attachment array. |
514 $object = array( |
514 $attachment = array( |
515 'post_title' => $filename, |
515 'post_title' => $filename, |
516 'post_content' => $url, |
516 'post_content' => $url, |
517 'post_mime_type' => $type, |
517 'post_mime_type' => $type, |
518 'guid' => $url, |
518 'guid' => $url, |
519 'context' => 'custom-background', |
519 'context' => 'custom-background', |
520 ); |
520 ); |
521 |
521 |
522 // Save the data. |
522 // Save the data. |
523 $id = wp_insert_attachment( $object, $file ); |
523 $id = wp_insert_attachment( $attachment, $file ); |
524 |
524 |
525 // Add the metadata. |
525 // Add the metadata. |
526 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); |
526 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); |
527 update_post_meta( $id, '_wp_attachment_is_custom_background', get_option( 'stylesheet' ) ); |
527 update_post_meta( $id, '_wp_attachment_is_custom_background', get_option( 'stylesheet' ) ); |
528 |
528 |