<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>svg &#8211; Snippets</title>
	<atom:link href="http://wp.djtedfunke.com/tag/svg/feed/" rel="self" type="application/rss+xml" />
	<link>http://wp.djtedfunke.com</link>
	<description></description>
	<lastBuildDate>Fri, 11 Jan 2019 09:54:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.3</generator>

<image>
	<url>http://wp.djtedfunke.com/wp-content/uploads/2018/12/cropped-front-end_developer-2-512-32x32.png</url>
	<title>svg &#8211; Snippets</title>
	<link>http://wp.djtedfunke.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Replace SVG to inline</title>
		<link>http://wp.djtedfunke.com/replace-svg-to-inline/</link>
		
		<dc:creator><![CDATA[tadej]]></dc:creator>
		<pubDate>Tue, 01 Jan 2019 22:14:09 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[svg]]></category>
		<guid isPermaLink="false">http://wp.djtedfunke.com/?p=130</guid>

					<description><![CDATA[Replace image SVG to inline SVG]]></description>
										<content:encoded><![CDATA[
<p>Replace image SVG to inline SVG</p>



<pre class="wp-block-code"><code>    $('img.svg').each(function(){
        var $img = jQuery(this);
        var imgID = $img.attr('id');
        var imgClass = $img.attr('class');
        var imgURL = $img.attr('src');

        jQuery.get(imgURL, function(data) {
            // Get the SVG tag, ignore the rest
            var $svg = jQuery(data).find('svg');

            // Add replaced image's ID to the new SVG
            if(typeof imgID !== 'undefined') {
                $svg = $svg.attr('id', imgID);
            }
            // Add replaced image's classes to the new SVG
            if(typeof imgClass !== 'undefined') {
                $svg = $svg.attr('class', imgClass+' replaced-svg');
            }

            // Remove any invalid XML tags as per http://validator.w3.org
            $svg = $svg.removeAttr('xmlns:a');

            // Check if the viewport is set, if the viewport is not set the SVG wont't scale.
            if(!$svg.attr('viewBox') &amp;&amp; $svg.attr('height') &amp;&amp; $svg.attr('width')) {
                $svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width'))
            }

            // Replace image with new SVG
            $img.replaceWith($svg);

        }, 'xml');
    });</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SVG support</title>
		<link>http://wp.djtedfunke.com/svg-support/</link>
		
		<dc:creator><![CDATA[tadej]]></dc:creator>
		<pubDate>Tue, 01 Jan 2019 21:29:14 +0000</pubDate>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[svg]]></category>
		<guid isPermaLink="false">http://wp.djtedfunke.com/?p=83</guid>

					<description><![CDATA[Adding SVG format: Additional fix:]]></description>
										<content:encoded><![CDATA[
<p>Adding SVG format:</p>



<pre class="wp-block-code"><code>function svg_mime_types( $mimes ) {
    $mimes['svg'] = 'image/svg+xml';
    return $mimes;
}
add_filter( 'upload_mimes', 'svg_mime_types' );</code></pre>



<p>Additional fix:</p>



<pre class="wp-block-code"><code>function fix_mime_type_svg( $data = null, $file = null, $filename = null, $mimes = null ) {
    $ext = isset( $data['ext'] ) ? $data['ext'] : '';
    if ( strlen( $ext ) &lt; 1 ) {
        $exploded = explode( '.', $filename );
        $ext      = strtolower( end( $exploded ) );
    }
    if ( $ext === 'svg' ) {
        $data['type'] = 'image/svg+xml';
        $data['ext']  = 'svg';
    } elseif ( $ext === 'svgz' ) {
        $data['type'] = 'image/svg+xml';
        $data['ext']  = 'svgz';
    }

    return $data;
}

add_filter( 'wp_check_filetype_and_ext', 'fix_mime_type_svg', 75, 4 );</code></pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
