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