Note that this function is not applied for the Trial stores of Shopify
Before going to specific steps, you can watch this tutorial video
In this article, you’ll learn how to add custom fonts and apply them to your PageFly page.
Step 1: Download and convert the font to a web font format
Download the font
In our example, we download a font from www.dafont.com. Let’s do it.
After downloading the font you should see the following files in a zipped folder. You’ll need to convert two files with extension “otf” and “ttf”.
Convert the font to the WOFF and WOFF 2
You need to visit https://transfonter.org/ to convert the font above.
Click Add fonts to upload the 2 files above. Tick the “WOFF” and “WOFF2” checkbox in the Formats section.
Click Convert to see the “download” link and download.
On your computer, there should be 2 files with “woff” and “woff2” extension.
Upload the font to your Shopify store and update
In your Shopify dashboard please navigate to Settings > Files
Then upload 2 font files: woff and woff2 to your store.
In the URL column please copy URLs of those fonts to your notepad or somewhere else. We’ll use them in Step 2.2 when we apply 2 fonts to our PageFly page. In our example, the fonts URLs are: https://pastebin.com/raw/TPy3kZdw
Step 2: Apply the font to the PageFly page
Open the font CSS file and replace it with Shopify font URLs
On your computer, find the font folder you downloaded in the previous part and look for the file “stylesheet.css” then open it.
You can open that file with Brackets.io or alternative app.
- After opening the file you’ll see the code below.
(embed this https://pastebin.com/raw/4A7TsSrY)
- You need to replace the URL for woff2 and woff files with the Shopify URL you got in Step 1.3. So in our case, it’ll be the code below. You’ll need to copy this piece of code to the Add custom Code of your page. Let’s do it.
(embed this https://pastebin.com/raw/LAKtthLV)
Copy the piece of code you got from the “stylesheet.css” file
Now you need to decide if you want to apply the custom font to the whole page or to the specific element.
Apply the custom font to the whole page
(Embed this https://pastebin.com/raw/F60J8pxr)
Apply the custom font to a specific element
Select the element you want to be applied to the custom font. In this example, we choose the Heading element and we want to apply the custom for it.
In General > choose ATTRIBUTES parameter, put a name in Class. For example: custom-font. You can see the image below:
Then embed this https://pastebin.com/raw/hNn8xU1k
(replace *:not(.pfa) in Step 2.3 to .custom-font)
Please note that you shouldn’t choose any font from Styling > Typography > Font Family to make this code work.
You followed the article but it doesn’t work on your pages?
Let’s join our PageFly Community to share and discuss the issue with other merchants and our PageFly team. You will also get more exclusive content and promotion there!