Created
September 20, 2017 05:42
-
-
Save johnjullies/93ecf3f1e5c9e5feba66b48b13bc38cb to your computer and use it in GitHub Desktop.
svg support for Wordpress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* SVG support | |
*/ | |
function svg_mime_types( $mimes ) { | |
$mimes['svg'] = 'image/svg+xml'; | |
return $mimes;} | |
add_filter( 'upload_mimes', 'svg_mime_types' ); | |
function svg_size() { | |
echo '<style> | |
svg, img[src*=".svg"] { | |
max-width: 150px !important; | |
max-height: 150px !important; | |
} | |
</style>'; | |
} | |
add_action('admin_head', 'svg_size'); | |
/** | |
* end SVG support | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment