Good for acting on specific pieces of your SVG object instead of just link as an <img>
you can bring the entire object into your HTML. You need two things:
- SVG file with a double extension ending with
.php
- e.g.logo.svg.php
- WP include statement with the built-in function
get_template_part
<?php
get_template_part( 'includes/partials/logo', 'logo.svg' );
?>
That'll strip off the .php
extension and bring in the entire SVG object. Your SVG can be straight up exported from Illustrator or what have you, nothing special in there. But remember you'll need to give it an ID so you can access it via CSS.
I caught your blog post and it really interested me but I could not get it to work. I'm glad you posted this because now that I see your SVG's source I got it working by removing some tags which Illustrator inserted before the opening
<svg>
tag. Thanks for posting this!