Last active
May 21, 2022 11:12
-
-
Save kimcoleman/5869ca9d0d252e1b7dafc5e165a82cea to your computer and use it in GitHub Desktop.
How to use Feather Icons (https://feathericons.com/) in your WordPress site.
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 | |
/** | |
* Use Feather Icons (https://feathericons.com/) in your WordPress site. | |
* | |
* First, save a copy of feather.min.js to a custom plugin. | |
* Get it here: https://unpkg.com/feather-icons | |
* | |
*/ | |
// Enqueue the Feather script file. | |
function my_kimcoleman_scripts() { | |
wp_enqueue_script( 'feather', plugins_url( 'feather.min.js', __FILE__ ), array(), '4.29.0' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'my_kimcoleman_scripts' ); | |
// Call the feather.replace() method. | |
function my_kimcoleman_feather() { ?> | |
<script> | |
feather.replace(); | |
</script> | |
<?php | |
} | |
add_action( 'wp_footer', 'my_kimcoleman_feather' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment