Skip to content

Commit

Permalink
Update to new media manager.
Browse files Browse the repository at this point in the history
Getting rid of the old thickbox infavor of WordPress 3.5's manager.
Also adds a brief message that will hopefully cut down on the number of
users that insist on inserting
  • Loading branch information
Michael Sisk committed Jan 24, 2013
1 parent 2456c90 commit 36d8e2c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions -/php/posts.php
Expand Up @@ -141,8 +141,7 @@ public function admin_enqueue_scripts() {
wp_enqueue_script( 'webcomic-admin-meta' );

if ( !in_array( 'editor', self::$config[ 'collections' ][ $screen->id ][ 'supports' ] ) ) {
add_thickbox();
wp_enqueue_script( 'media-upload' );
wp_enqueue_media();
}
}
}
Expand Down Expand Up @@ -718,7 +717,7 @@ public static function ajax_media_preview( $id ) {
$old_content_width = $content_width;
$content_width = 266;

printf( '<a href="%s" class="thickbox">', esc_url( str_replace( array( 'post_id=0', 'TB_iframe=1' ), array( "post_id={$id}", 'tab=gallery&TB_iframe=1' ), get_upload_iframe_src( 'image' ) ) ) );
echo '<style scoped>.insert-media img{vertical-align:bottom}</style><a href="#" class="insert-media">';

foreach ( $attachments as $attachment ) {
echo isset( $_wp_additional_image_sizes[ 'post-thumbnail' ] ) ? wp_get_attachment_image( $attachment->ID, 'post-thumbnail' ) : wp_get_attachment_image( $attachment->ID, array( $content_width, $content_width ) );
Expand All @@ -730,7 +729,10 @@ public static function ajax_media_preview( $id ) {
} else {
$post_ID = $post_ID ? $post_ID : $id;

printf( '<a href="%s" class="thickbox">%s</a>', get_upload_iframe_src( 'image' ), __( 'Add Attachments', 'webcomic' ) );
printf( '<a href="#" class="button insert-media">%s</a><p>%s</p>',
__( 'Add Media', 'webcomic' ),
__( 'Webcomic will automatically recognize any images attached to this post. You <strong>do not</strong> have to insert them directly into the post content.', 'webcomic' )
);
}
}

Expand Down

0 comments on commit 36d8e2c

Please sign in to comment.