Ticket #26695: 26695.diff
File 26695.diff, 5.1 KB (added by , 11 years ago) |
---|
-
wp-includes/class-wp-theme.php
904 904 } 905 905 906 906 /** 907 * Returns an array with all the theme's screenshots, checking for files 908 * in the form of 'screenshot-n' at the root of a theme directory. 909 * 910 * Maximum allowed is five screenshots total. 911 * 912 * @todo Hardcoded to pngs -- support jpg, etc. 913 * @todo Set up caching. 914 * 915 * @see WP_Theme::get_screenshot() 916 * 917 * @param a theme object 918 * @return array Screenshots. First element is default screenshot. 919 */ 920 public function get_multiple_screenshots() { 921 $base = $this->get_stylesheet_directory_uri(); 922 $set = array( 2, 3, 4, 5 ); 923 924 // Return early if there is no main screenshot 925 if ( $this->get_screenshot() ) { 926 return false; 927 } 928 929 // Screenshots array starts with default screenshot at position [0] 930 $screenshots = array( $this->get_screenshot() ); 931 932 // Check how many other screenshots a theme has 933 foreach ( $set as $number ) { 934 // Hard-coding file path for pngs... 935 $file = '/screenshot-' . $number . '.png'; 936 $path = $this->template_dir . $file; 937 938 if ( ! file_exists( $path ) ) 939 continue; 940 941 $screenshots[] = $base . $file; 942 } 943 944 return $screenshots; 945 } 946 947 /** 907 948 * Return files in the theme's directory. 908 949 * 909 950 * @since 3.4.0 -
wp-admin/includes/theme.php
411 411 $prepared_themes[ $slug ] = array( 412 412 'id' => $slug, 413 413 'name' => $theme->display( 'Name' ), 414 'screenshot' => array( $theme->get_screenshot() ), // @todo multiple414 'screenshot' => $theme->get_multiple_screenshots(), 415 415 'description' => $theme->display( 'Description' ), 416 416 'author' => $theme->display( 'Author', false, true ), 417 417 'authorAndUri' => $theme->display( 'Author' ), -
wp-admin/js/theme.js
363 363 if ( image.width && image.width <= 300 ) { 364 364 el.addClass( 'small-screenshot' ); 365 365 } 366 }, 367 368 // Setups an image gallery using the theme screenshots supplied by a theme 369 screenshotGallery: function() { 370 var el, img, 371 screenshots = $( '.theme-screenshots' ); 372 373 // Select the first item 374 screenshots.find( '.thumb' ).first().addClass( 'selected' ); 375 376 // Clicking on a screenshot thumbnail drops it 377 // at the top of the stack in a larger size 378 screenshots.on( 'click', 'div.thumb', function() { 379 el = $( this ); 380 img = $( this ).find( 'img' ).attr( 'src' ); 381 382 // Change src attribute of first image 383 screenshots.find( '.screenshot' ).first().find( 'img' ).attr( 'src', img ); 384 // Mark the new image as 'selected' 385 el.siblings( '.selected' ).removeClass( 'selected' ); 386 el.addClass( 'selected' ); 387 }); 366 388 } 367 389 }); 368 390 … … 538 560 539 561 this.overlay.render(); 540 562 this.$overlay.html( this.overlay.el ); 563 this.overlay.screenshotGallery(); 541 564 542 565 // Bind to theme:next and theme:previous 543 566 // triggered by the arrow keys -
wp-admin/css/wp-admin.css
6877 6877 margin: 0 30px 0 0; 6878 6878 width: 55%; 6879 6879 max-width: 880px; 6880 text-align: center;6881 6880 } 6882 6881 6883 6882 /* First screenshot, shown big */ … … 6918 6917 /* Other screenshots, shown small and square */ 6919 6918 .theme-overlay .screenshot.thumb { 6920 6919 background: #ccc; 6921 border: 1px solid #eee;6920 border: 2px solid #fff; 6922 6921 float: none; 6923 6922 display: inline-block; 6924 margin: 10px 5px 0; 6925 width: 140px; 6926 height: 80px; 6923 margin: 10px 5px 0 0; 6924 width: 80px; 6927 6925 cursor: pointer; 6926 padding: 3px; 6928 6927 } 6929 6928 6930 6929 .theme-overlay .screenshot.thumb:after { … … 6935 6934 6936 6935 .theme-overlay .screenshot.thumb img { 6937 6936 cursor: pointer; 6937 width: 300px; 6938 6938 height: auto; 6939 6939 position: absolute; 6940 left: 0; 6941 top: 0; 6942 width: 100%; 6943 height: auto; 6940 left: 0; 6941 top: 0; 6942 box-sizing: border-box; 6944 6943 } 6945 6944 6946 6945 .theme-overlay .screenshot.selected { 6947 background: transparent; 6948 border: 2px solid #2ea2cc; 6946 background: #0074a2; 6947 border-color: #0074a2; 6948 box-shadow: none; 6949 6949 } 6950 6950 6951 6951 .theme-overlay .screenshot.selected img { 6952 opacity: 0. 8;6952 opacity: 0.6; 6953 6953 } 6954 6954 6955 6955 /* No screenshot placeholder */ -
wp-admin/themes.php
317 317 <div class="theme-screenshots"> 318 318 <# if ( data.screenshot[0] ) { #> 319 319 <div class="screenshot"><img src="{{ data.screenshot[0] }}" alt="" /></div> 320 <# 321 if ( _.size( data.screenshot ) > 1 ) { 322 _.each ( data.screenshot, function( image ) { 323 #> 324 <div class="screenshot thumb"><img src="{{ image }}" alt="" /></div> 325 <# 326 }); 327 } 328 #> 320 329 <# } else { #> 321 330 <div class="screenshot blank"></div> 322 331 <# } #>