Blog de programación, errores, soluciones

Adding Font Awesome to WordPress

At some point is probable that you want to add Font Awesome to your page or blog created in wordpress.

This is relative easy you can create a user in font awesome and adding the corresponding code to your page template.

But this maybe not give us the best performance and we want to have the best performance.

Creating an Account in Font Awesome

First we need a Font awesome account, we can create one in

https://fontawesome.com/start

When we enter in font awesome, you will see an option to enter your email, this is to create a free account.

Once we give our email we will recive an email to finish our registration.

Adding code to our page

After creating our account, we need to enter in our account, select manage kit, and inside mange kit create one, if you already have one use it.

Free accounts only permit one kit, do not share your kit online.

Once you have a kit, click on the kit name.

Then we will have a code fragment, we have to add this code to our page to work. It has a part that explain how to add it to your page, but it’s better to add your code differently.

The code is like this:

<script src="https://kit.fontawesome.com/fake2u823753.js" crossorigin="anonymous"></script>

This code exposed here is fake do not copy, get yours.

Once you have your code you must put before close body tag(</body>), this avoids that the code block the page load, and be executed once HTML finish charge.

On wordpress generally the </body> close tag is inside the template being used, file footer.php

Particularly, I don’t like to depend on the src from the other page so y copy the code from the src link.

En Particular a mí no me gusta en depender en un src que depende de otra página así que lo que hago es copiar lo que tenga el link del src.

Finally, you get a code like this.

<script crossorigin="anonymous">
/*code inside https://kit.fontawesome.com/fake2u823753.js goes here*/
</script>
<?php wp_footer();?>
</body>
</html>
Somethig wrong? If you found an error or mistake on the content you can contact me on twitter | @luisg2249_luis.
Last 4 post in same category