This topic contains 9 replies, has 2 voices, and was last updated by Leo 1 week, 2 days ago.
March 26, 2020 at 3:19 am #1210438
I’m trying to add an inline SVG image as a href link (so it can be styled via CSS) to the Copyright section of my sites footer.
However, the SVG code is stripped out or, if entered as a data URI, displayed raw on the page.
Is there a recommended (and safe) way to do this?
(Using a link to an external SVG displays ok, but then can’t be styled via CSS).
Thanks for any tips.
GPP v1.9.1March 26, 2020 at 9:49 am #1210975
Leo Customer SupportMarch 26, 2020 at 9:53 am #1210985
Thanks, I’ve added the link to the private URL field.
It’s the “Site by” logo at the very bottom right of the page.
I was hoping to use the
fill: currentColor;CSS as mentioned here, to allow the logo to adopt the color of the surrounding text, and then use CSS to change the fill colour on hover.
GPP v1.9.1March 26, 2020 at 5:27 pm #1211346
Leo Customer SupportMarch 27, 2020 at 1:47 am #1211562
Here’s a reduced case example. If you add the following code into the regular page content, the SVG displays and inherits the colour of the parent, including hover colour changes.
<a href="#"><svg viewBox="0 0 23 23" height="20" width="20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><circle cx="11.25" cy="11.25" r="11.25" fill="currentColor"/></svg> Inherits link color with hover</a>
If you enter exactly the same code into Customiser > Layout > Footer > Copyright the SVG doesn’t display in the preview and the SVG code is stripped out when saving.
I’ve tried with the Safe SVG and SVG Support plugins but they make no difference.
EDIT: If I generate the copyright section using the ‘generate_copyright‘ function rather than the customiser, it works.
GPP v1.9.1March 27, 2020 at 8:46 am #1212123
Leo Customer SupportMarch 27, 2020 at 8:50 am #1212128
Thanks. It would be useful/easier if I could just use the Copyright field of the Customizer.
Do you think this is a bug, and if so, is it within GeneratePress (and potentially could be fixed) or within core WordPress functionality?
GPP v1.9.1March 27, 2020 at 8:54 am #1212135
Leo Customer SupportMarch 27, 2020 at 9:11 am #1212175
GPP v1.9.1March 27, 2020 at 11:26 am #1212289
You must be logged in to reply to this topic.