WPIntell

Source evidence

Adding SVG icon in headings (h1, h2, etc..)

Easy SVG Support · support · 2021-11-15T01:25:00+00:00

mixedsentiment
mediumseverity
0.72relevance
4replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

5 / 25 rows with source links

20.0% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

20 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
John resolved
Hello, Thanks for this great plugin! I’m using this CSS snippet for adding external Font Awesome icons in headings, like H1 here: h1:before { content: "\f192 "; font-family: "FontAwesome"; color: red; } Would it be possible to do the same with SVG icons uploaded in the Media Library? I tried to add the icon’s URL for “content” but doesn’t seem to work. My icon URL is something like this: https://example.com/wp-content/uploads/2021/11/test.svg Thanks! Hallo 🙂 I’m so sorry but this plugin is only to update SVG Files in the Media library. If you want to display, than you have to embet the FontAwesome Font into your CSS file. If you don’t have experience than you can look for a plugin here on wordpress.org for FontAwesome. Than you can use this libary. Greetings from Germany Benjamin Zekavica Thanks, well noted. Hi I am uploading an animated svg and it keeps getting changed e.g. <use xlink:href="#r1" transform="rotate(60 160 160)"></use> It keeps adding the </use> and then it stops the svg showing. How can I stop the plugin from doing this as it shows up blank then. Thanks @nanny7 Yes for this usecase you have to use the hooks. In my plugin I added SVG Sanitizer for clean the files. Add this to your functions.php and modify your used tags and attributes. // XML TAGS add_filter( 'esw_svg_allowed_tags', function ($tags) { $tags[] = 'p'; $tags[] = 'info'; return $tags; } ); // XML attributes add_filter( 'esw_svg_allowed_attributes', function ( $attributes ) { $attributes[] = 'src'; return $attributes; } );

Comments

4 shown
Benjamin Zekavica 2022-01-26T20:52:00+00:00

Hallo 🙂 I’m so sorry but this plugin is only to update SVG Files in the Media library. If you want to display, than you have to embet the FontAwesome Font into your CSS file. If you don’t have experience than you can look for a plugin here on wordpress.org for FontAwesome. Than you can use this libary. Greetings from Germany Benjamin Zekavica

John 2022-01-27T00:17:00+00:00

Thanks, well noted.

nanny7 2022-06-23T03:31:00+00:00

Hi I am uploading an animated svg and it keeps getting changed e.g. <use xlink:href="#r1" transform="rotate(60 160 160)"></use> It keeps adding the </use> and then it stops the svg showing. How can I stop the plugin from doing this as it shows up blank then. Thanks

Benjamin Zekavica 2022-09-02T20:05:00+00:00

@nanny7 Yes for this usecase you have to use the hooks. In my plugin I added SVG Sanitizer for clean the files. Add this to your functions.php and modify your used tags and attributes. // XML TAGS add_filter( 'esw_svg_allowed_tags', function ($tags) { $tags[] = 'p'; $tags[] = 'info'; return $tags; } ); // XML attributes add_filter( 'esw_svg_allowed_attributes', function ( $attributes ) { $attributes[] = 'src'; return $attributes; } );