Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to use Feather Icons (https://feathericons.com/) in your WordPress site.
<?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