Skip to content

Instantly share code, notes, and snippets.

@kimcoleman
Last active May 21, 2022 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimcoleman/5869ca9d0d252e1b7dafc5e165a82cea to your computer and use it in GitHub Desktop.
Save kimcoleman/5869ca9d0d252e1b7dafc5e165a82cea to your computer and use it in GitHub Desktop.
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