Issue with wp_get_attachment_image() and SVG file type

I’m trying to use SVG image with wp_get_attachment_image() but it is generating very weird output at the front end of the website. To support SVG file type I’ve first added the following function in my theme’s functions.php file /*** enable svg support ***/ function cc_mime_types($mimes) { $mimes[‘svg’] = ‘image/svg+xml’; return $mimes; } add_filter(‘upload_mimes’, ‘cc_mime_types’); Then … Read more

How to upload SVG in WordPress 4.9.8?

I tried uploading after installing different plugins. Even added a filter to functions.php file. function add_svg_to_upload_mimes( $upload_mimes ) { $upload_mimes[‘svg’] = ‘image/svg+xml’; $upload_mimes[‘svgz’] = ‘image/svg+xml’; return $upload_mimes; } add_filter( ‘upload_mimes’, ‘add_svg_to_upload_mimes’, 10, 1 ); But still uploading an SVG gives the following error. 6 s 6 This question had me scratching my head. Yeah, how … Read more

How to change the color of an svg element?

I want to use this technique and change the SVG color, but so far I haven’t been able to do so. I put this in the CSS, but my image is always black, no matter what. My code: .change-my-color { fill: green; } <svg> <image class=”change-my-color” xlink:href=”https://svgur.com/i/AFM.svg” width=”96″ height=”96″ src=”https://stackoverflow.com/questions/22252472/ppngfallback.png” /> </svg> 33 s 33

Ways to handle SVG rendering in wordpress?

With the advancement of internet browsers, I find myself more and more comfortable using SVGS when coding websites… especially for icons, and simple graphics that can be replaced on the fly by pngs. It looks like wordpress almost supports SVGS. I say almost because: It’s not by default an allowed file type in wordpress. So … Read more