4

This is my original code that pulled Font Awesome icons, which is placed in my functions.php file:

wp_enqueue_style( 'prefix-font-awesome', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.1/css/font-awesome.min.css', array(), '4.6.1' );

They've recently started offering unique embed codes that appear like so:

<script src="https://use.fontawesome.com/##########.js"></script>

But I'm not sure how to use this with wp_enqueue_style.

1
  • 3
    You'll have to use wp_enqueue_script, but it is similar.
    – cjbj
    Commented May 23, 2016 at 13:58

1 Answer 1

3

The full snippet would be this:

wp_enqueue_script( 'prefix-font-awesome', 'https://use.fontawesome.com/##########.js' );
3
  • Why did you use 'wp_enqueue_script' instead of 'wp_enqueue_style' for CSS? Commented Sep 22, 2017 at 9:37
  • 2
    @IamtheMostStupidPerson Because it's not css but javascript.
    – cjbj
    Commented Sep 23, 2017 at 10:58
  • 1
    Is it have any difference on using https:// rather than //address ?
    – Vishwa
    Commented Jul 31, 2018 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.