Created
April 28, 2018 07:52
-
-
Save noudadrichem/ba8bacfe89bfc38a4fb4e436ac892403 to your computer and use it in GitHub Desktop.
allows SVG mime types in Wordpress, put this snippet in your themes `functions.php` and you're done.
This file contains 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
<?php | |
# mime = meme | |
function cc_mime_types($memes) { | |
$memes['svg'] = 'image/svg+xml'; | |
return $memes; | |
} | |
add_filter('upload_mimes', 'cc_mime_types'); | |
function fix_svg() { | |
echo '<style media="screen"> | |
td.media-icon img[src$=".svg"], img[src$=".svg"].attachment-post-thumbnail { | |
width: 100% !important; | |
height: auto !important; | |
} | |
</style>'; | |
} | |
add_action('admin_head', 'fix_svg'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment