Skip to content

Tag: svg

Can I pass wp permalinks to an svg file?

I’ve got an svg file for a hero image, and I want certain paths to be internal links. I’ve wrapped the paths in an anchor tag, and putting in static links works, but I’d like them to be dynamic so I can changed them in the wp admin. Is this possible? How can I send the permalink data to the

SVG sprite file – is it necessary for it to have “.svg” extension, or is php/nothing ok so long as the content type header is set correctly?

I have a PHP script that generates my SVG sprite on the fly. Naturally that file ends in .php, not .svg. I’m setting the Content-type at the top of the script with header(‘Content-type: image/svg+xml’); I have nginx set up in such a way that php extensions are optional, so I can now reference my svg icons with: <use href=”/icons#svg-save-icon” xlink:href=”/icons#svg-save-icon”

SVG icon in twig template

I’m struggling with svg icons. I’m creating menu and to do this I have to use several of svg icons. I already know, that if I want to manipulate colour with help CSS (for example when icon is active/hover) I have to use in HTML <svg> tag not <img src=”path-to-icon.svg”/>. How can I solve this problem in a nice way?