Last active
May 8, 2016 09:35
-
-
Save samikeijonen/00644da70e4b20ce08d4e8dc04746b9a to your computer and use it in GitHub Desktop.
Inline SVG sprite
This file contains hidden or 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
| <body> | |
| <?php | |
| // 1. Include SVG images from assets/images folder right after <body> element. | |
| $svg_icons = get_template_directory() . '/assets/images/svg-icons.svg'; | |
| require_once( $svg_icons ); | |
| // 2. Include for example Twitter icon from SVG sprite. This can be anywhere in your markup. | |
| ?> | |
| <svg class="icon icon-twitter"> | |
| <use xlink:href="#twitter-icon"></use> | |
| <svg> | |
| <?php | |
| // 3. Or even better use function _s_get_svg() found in wd_s to generetate the markup. | |
| // @link: https://github.com/WebDevStudios/wd_s/blob/master/inc/template-tags.php#L124 | |
| echo _s_get_svg( array( 'icon' => 'twitter' ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment