How to add SVG images without a plugin

by | Jan 10, 2018 | Dark Side, Divi, WordPress

SVG What?

SVG stands for Scalable Vector Graphics.

This means they dont get pixelated, doesn’t matter how big or small you want to make them, you will never see a pixel in them.

It’s not recommended to use it for large graphics, just keep it for logos and icons.

SVG graphics are made of HTML code and can be styled with CSS. Also they can be animated.

No one creates SVG directly with code, you can use programs like Adobe Ilustrator, but behind the scenes is all code.

The next HTML code creates a basic SVG circle, Example:

1
 

Let's see how to add them

Open up your Child Theme functions.php. If you don't have a Child Theme yet I recommend to create one using this guide

Let's paste this code, be sure the code is wrapped around the the php open and close tags of the functions.php file.

1
2
3
4
5
6
// Allow SVG uploads
function allow_svgimg_types($mimes) {
  $mimes['svg'] = 'image/svg+xml';
  return $mimes;
}
add_filter('upload_mimes', 'allow_svgimg_types');

You are done and ready

Start uploading SVG to the WordPress gallery and using them, forget about plugins with this simple snippet :-).

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

How to Cache and Boost WordPress Performance

Want to boost your site performance? Learn how to do it by activating caching in your site. With a simply and clean plugin and as always in a couple of minutes. Let’s not forget about the small extra for fixing Google Analytics!.

How to Make any Element Fixed – Divi Builder

Want to learn how to make any Section / Row / Module fixed? So whenever you scroll the element stays in there with you! Learn how to achieve this trick in a couple of minutes with R2D2 help!.

How to Maintain a WordPress Site Clean

Hello everyone, is time to talk about how can you clean your WordPress site for a better maintenance, optimization and security purposes in just a couple of minutes once again!

Follow MasterDivi on Facebook

Be updated with the latest tricks!