Changeset 1465345
- Timestamp:
- 08/01/2016 05:48:47 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scalable-vector-graphics-svg/trunk/scalable-vector-graphics.php
r1463278 r1465345 73 73 // Thus the below is needed. 74 74 // 75 // Consider this the "client side" fix for dimensions. 75 // Consider this the "client side" fix for dimensions. But only for the Administration. 76 76 // 77 77 // WordPress requires inline administration styles to be wrapped in an actionable function. 78 78 // These styles specifically address the Media Listing styling and Featured Image 79 79 // styling so that the images show up in the Administration area. 80 function styles() {80 function administration_styles() { 81 81 // Media Listing Fix 82 82 wp_add_inline_style( 'wp-admin', ".media .media-icon img[src$='.svg'] { width: auto; height: auto; }" ); … … 85 85 } 86 86 87 // Browsers may or may not show SVG files properly without a height/width. 88 // WordPress specifically defines width/height as "0" if it cannot figure it out. 89 // Thus the below is needed. 90 // 91 // Consider this the "client side" fix for dimensions. But only for the End User. 92 function public_styles() { 93 // Featured Image Fix 94 echo "<style>.post-thumbnail img[src$='.svg'] { width: 100%; height: auto; }</style>"; 95 } 96 87 97 // Do work son. 88 98 add_filter( 'upload_mimes', __NAMESPACE__ . '\\allow_svg_uploads' ); 89 99 add_filter( 'wp_prepare_attachment_for_js', __NAMESPACE__ . '\\adjust_response_for_svg', 10, 3 ); 90 add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\\styles' ); 100 add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\\administration_styles' ); 101 add_action( 'wp_head', __NAMESPACE__ . '\\public_styles' ); 91 102 92 103 ?>
Note: See TracChangeset
for help on using the changeset viewer.