How to add font awesome to a child theme in magento 2
Hi everybody, I am Cuong, Welcome back to my Magento 2 tutorial video series.
In the previous lessons, I showed everybody:
How to create a child theme in Magento 2 in the video link
How to change the font family in Magento 2 in the video link
If you don’t watch these lessons yet, you should pause this video and see them.
To continue the previous lessons, Today, I am going to show everybody a best practice, How to add font awesome to a child theme in Magento 2.
Why should we use the font awesome?
1. It is quite free.
2. Easy to import and use
3. There are 1341 free icons (the current version is 5.3.1)
You can get the free icons of the font awesome in the link
In this practice, we are going to import the font awesome using free CDN. This is the best way to start using free icons right away.
Okie, let’s go.
Let’s do this practice you need to follow steps by step:
Step 1: Add external resources to the head element of the web page.
We need to add it in the head element of a web page.
– Let’s add external resources to the head element of a web page in Magento 2, we are going to add it in the file path app/design/frontend/phpcuong/giaphufashion/Magento_Theme/layout/default_head_blocks.xml
You can learn more how to use the file named default_head_blocks.xml in Magento 2 here
– Create the new file named default_head_blocks.xml in the path app/design/frontend/phpcuong/giaphufashion/Magento_Theme/layout/
Step 2: Test and see the results
Run the command line:
php bin/magento cache:flush
– Try to use the dot-circle icon for the product description.
We will try to change the dots in the product description by the dot-circle in the font awesome. Go to the backend
Search for the product named Radiant Tee
Yeah, we imported it successfully,
It works perfectly.
Okie, that was the simple best way to import the font awesome to a child theme in Magento 2.
Thank you for your watching. If you have any questions about this practice please feel free to leave a comment below.
Don’t forget to like, comment, share and subscribe to my channel for getting the latest videos.
Please do not hesitate to contact me if you need me to join your Magento project. My rate is $25/hour in Magento 1 and $30/hour in Magento 2.