Last active
May 11, 2016 15:18
-
-
Save kareemkibue/c2b0ed64a17c6a2f199cdd900beedece to your computer and use it in GitHub Desktop.
Rendering SVG icons in PHP/WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function render_icon($icon_id, $class=null){ | |
?> | |
<svg class="ico <?php echo $class; ?>"> | |
<use xlink:href="<?php echo get_template_directory_uri() .'/images/icons.svg#'. $icon_id; ?>"> | |
</svg> | |
<?php | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment