On December 30, 2019, I learned...

How to echo the contents of an SVG file with PHP

Using this is so much cleaner in the template files than copying and pasting the entire SVG code. Plus, it lets me manage all of my SVG files from a central location. Update it once, and the changes are applied everywhere!

<?php echo file_get_contents( get_template_directory_uri() . '/dist/img/logo.svg' ); ?>

1 Comments

  1. Mario
    # October 7, 2021

    thanks

Comments are closed.