Skip to content

Instantly share code, notes, and snippets.

@mattradford
Created April 8, 2016 17:08
Show Gist options
  • Save mattradford/f11bc4da7a06c742377307f621450cd6 to your computer and use it in GitHub Desktop.
Save mattradford/f11bc4da7a06c742377307f621450cd6 to your computer and use it in GitHub Desktop.
SVG output function
// Check and return an SVG icon inline
// Adapted from https://jdsteinbach.com/wordpress/using-svgs-wordpress/
// Needs SVG Support plugin as well
function tend_print_svg( $icon ) {
if ( false !== strpos( $icon, '.svg' ) ) {
$icon = str_replace( site_url(), '', $icon );
include( ABSPATH . $icon );
}
return $icon;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment