Without a Kit: follow the instructions for loading the v4 shims with SVG or Webfont, depending on which technology you've chosen to use.What are the extra gourmet ingredients, you ask? That's another long story. With a Kit: v4 compatibility is baked in (with some extra gourmet ingredients, not found in the other v4 compatibility recipes) So set up your kit in WordPress), and then in your kit settings, enable v4 compatibility.How you do that will depend on which way your trying to set up Font Awesome: When the conflicts you remove include Font Awesome version 4, and your theme or plugins reference icons by names that changed between version 4 and version 5, you'll need to do a little more work, adding the v4 shims. Note that when choosing specific styles, there will be always be one additonal that loads the base fontawesome.css, which is required.įor example, if you wanted to load only the Solid style for Font Awesome Free version 5.15.4, you'd get this from the CDN Picker: If you want to load a subset of styles, instead of all.css, use the CDN Picker to select the styles you want, and then translate each resulting into a separate invocation of fa_custom_setup_cdn_webfont() in your functions.php. Then use the resulting href and integrity attributes to update the arguments to fa_custom_setup_cdn_webfont() in your functions.php. If you want to change the version you're loading in WordPress, go back to the CDN Picker and use it to select the new version. It's a security feature that tells the web browser how to verify that the file is exactly the expected file and has not been tampered with. The second argument corresponds to the integrity attribute from the CDN Picker. The first function argument corresponds to the href attribute from the element provided by the CDN Picker. */ if ( ! function_exists ( 'fa_custom_setup_cdn_svg' ) ) * This will load Font Awesome 5 from the Font Awesome Free or Pro CDN. Copy and paste this into your functions.php: You’ll only tweak the simpler code below to add your Kit token. You’ll probably never need to modify the code in this function. But if you aren't sure that you have such a use case on your hands, then that's a pretty good clue that setting up a kit is your best bet.įirst we’ll lay a foundation with this function that you’ll call with your Kit embed code. The "CDN" alternatives are offered because, sometimes, there are use cases where loading the Font Awesome assets directly from the CDN is preferable to loading a kit. Once you've set up a kit with one of these code snippets, you'll be able to configure and re-configure that kit right from your Font Awesome kit settings and not have to touch the PHP code again. In fact, kits are usually the best approach you can take for both performance and flexibility, especially Pro kits, especially especially SVG Pro kits. Kits are backed by a fast and stable CDN. So don't think that the kits approach in these examples is sans-CDN. Then we added kits, which are also backed by a CDN. Namely, before we had kits, the options were either to host the icon assets yourself (self-hosting), or load them from our Free or Pro CDN. The "without kits" approach is referred to as "CDN" in these examples mainly for legacy reasons. These examples and code snippets offer two different approaches to setting up Font Awesome in WordPress: with kits and without kits. I feel good about making some simple code changes to dial it in.I know how to make changes to my theme's functions.php file.I have write access to my WordPress theme's functions.php file.In order to make use of these code snippets, you need to be able to check off all of these boxes:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |