开发者 | Benbodhi |
---|---|
更新时间 | 2022年12月13日 07:25 |
捐献地址: | 去捐款 |
PHP版本: | 7.2 及以上 |
WordPress版本: | 6.1.1 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
"style-svg"
to your IMG elements (or outer containers), this plugin dynamically replaces any IMG elements containing an SVG in the src that are found inside the target class with your complete SVG code, rendering it inline.
The main purpose of this is to allow styling and animation of your SVG elements. Usually your styling options are restricted when using embed
, object
or img
tags alone.
Features
SVG Support 2.3 includes a new settings section called "Advanced Mode". Users that were inlining SVG files need to make sure this setting is checked. Go to your dashboard > Settings > SVG Support and check "Advanced Mode". All of your original settings should still be there.
If you go to Settings > SVG Support
in your admin dashboard, you can choose to enable "Advanced Mode" or not. If you leave it disabled, the advanced functionality and extraneous script is removed.
To allow SVG to work in the customizer, you will need to modify/add some code in your child theme's function file. Here is a great tutorial on how to do that. The important part is:
'flex-width' => true 'flex-height' => true
You will need to edit your SVG file in a code editor so you can add CSS classes to each element you need to target within the SVG. Make sure that your IMG tag is being swapped out for your inline SVG and then you can use CSS or JS to apply animations to elements within your SVG file.
If you installed multisite prior to WordPress 3.5, then you will need to remove your ms-files. Here is a couple of resources to help you: Dumping ms-files Removing ms-files after 3.5.
If you are using SVG Support with Visual Composer or any other page builders, you will need to make sure that you can add your own class to the image. The easiest way to do this is by using a simple text or code block in the builder to put your image code in to. Additionally, there is now a setting to force all SVG files to be rendered inline.
You need to add the mime type for svg and svgz to: "MLA Settings > Media Library Assistant > Uploads (tab)" and then it works.
bodhisvgsInlineSupport();
.