Archived topic
Use SVG sprite for icon
6 replies · Started by Laurentiu on January 25, 2022
Hi,
I am trying to use an SVG sprite for icons on specific elements, but the code is stripped out.
Below is an example:
<svg><use xlink:href="/wp-content/themes/generatepress_child/images/icons.svg#implant"></use></svg>
Is there any way around that?
Hi Laurentiu,
I don't think it's a theme issue.
Does that happen when you switch to twenty twenty one theme?
I don't think there is an option in that theme to add icons. I added the SVG in an HTML widget and it worked.
Any news on this?
Hi there,
where were you adding the SVG sprite HTML ?
Hi David.
I am trying to add it inside the Icon field for a button. Here is a screenshot.
Unfortunately there is no way around that at this time.
Both WP and GB sanitise that HTML. Anything that poses a security risk such as links will be stripped.
THe SVG HTML has to 100% inline HTML.