Fonts: Adding a custom downloaded font to your theme
In this tutorial, we will go through the steps of adding a free font, Gotham Bold which is not included in the theme. You can apply the same concept for your own font files.
- 1
-
Download your font
This font is available from external font repositories like Fonts Geek. For this tutorial, we are going to install Gotham Bold but you can use any font from fontsgeek.com:
http://fontsgeek.com/fonts/Gotham-Bold-Regular
The downloaded font will be in a .zip archive and contain a TrueType version of Gotham Bold. Unzip the font file and have it ready for conversion in the next step.
- 2
-
Convert the font
Use a font conversion service like Transfonter.org to create web ready fonts:
Steps to convert:
(1) Upload the unzipped Gotham Bold Regular.ttf font file.
(2) Choose all options except TTF (the file is already in TTF format).
(3) Finally, use the convert button and download the new converted fonts.
Press the green Convert button:
Use the Download link and save the converted fonts:
Important: After you download the .zip file to your computer - You'll need to unzip the file.
Both Mac and Windows should have built-in tools to uncompress the .zip file into a folder.
- 3
-
Skip steps 1 and 2, download all font files from Dropbox for Gotham Bold
Steps 1 and 2 are helpful if you're using a different font. For the rest of this tutorial, we'll use these already converted font files for Gotham Bold.
Use the Download button and choose Direct download:
This will download a folder to your computer called GothamBold.
- 4
-
Add font files to your theme
Open your Code Editor.
In the Assets folder, choose Add a new asset:
One by one, upload each of the 4 font files from the GothamBold folder from your computer:
Be sure to upload all 4 files.
- 5
-
Edit the Pipeline stylesheet
CSS code snippet to use:
Part 1
/* -- code to use Gotham font-family in theme -- */ @font-face { font-family: 'Gotham'; src: url('{{ "Gotham-Bold.eot" | asset_url }}'); src: url('{{ "Gotham-Bold.eot" | asset_url }}#iefix') format("embedded-opentype"), url('{{ "GothamBold.woff" | asset_url }}') format("woff"), url('{{ "GothamBold.woff2" | asset_url }}') format("woff2"), url('{{ "GothamBold.svg" | asset_url }}#GothamBold') format("svg"); font-weight: bold; font-style: normal; } /* - end - */
If you're not using Gotham and downloaded a different font file, then in the folder where you extracted the .ZIP file, you'll have a file called stylesheet.css.
Example (font called Septima):
Open that and it will have the code you need - Example:
You can use that instead.
Part 2
Also add any or all of these CSS snippets to modify where your custom font will be used in the theme:
Option 1: Headings
/* -- Pipeline override custom font: Headings -- */ .title,h1,.h1,h2,.h2,h3,.h3,h4.home__subtitle,h5.home--uppercase,.sky-pilot-access-denied h5,.sky-pilot-access-denied .h5,h4,.h4,h5,.h5,h6,.h6,.header-logo,.home__title,.title--flex,.product-form label,.password__hero { font-family: 'Gotham', sans-serif; } /* - end - */
Option 2: Body font
/* -- Pipeline override custom font: body font -- */ .body, .h1--body, .h2--body, .h3--body, .h4--body, .h5--body, .h6--body, p { font-family: 'Gotham', sans-serif; } /* - end - */
Option 3: Accents - Subheadings and buttons
/* -- Pipeline override custom font: accent - Subheadings and buttons -- */ .accent, .uppercase, .nav--mobile .main-menu li a.nav-link, .nav--desktop .main-menu>li>a, .nav--desktop .grandparent .parent .child a, .nav--desktop .grandparent>.main-menu-dropdown>ul>.parent>a, .nav--desktop .grandparent>.main-menu-dropdown>ul>.child>a, .nav--desktop .main-menu>.parent>.main-menu-dropdown, .footer-social, .footer-payment, .sticker, .share__link, .sidebar__item a, .selector-wrapper label, .quantity-selector__wrapper label, .blog__tag, .item__vendor, .product__add__message, .h1--accent, .h2--accent, .h3--accent, .h4--accent, .h5--accent, .home__subtitle, .h6--accent, .footer-secondary, .footer-quicklinks, .breadcrumb{ font-family: 'Gotham', sans-serif; } /* - end - */
Note: Change the font-family to your custom font if you're using a different font than Gotham.
Use the following link to learn where exactly to add this code snippet:
Where to add your CSS style code
Example after with Gotham Bold heading:
Alternate method - Only change font to certain heading types
Use this article to see different elements if you need to apply your custom font to only certain headings or text:
https://help.groupthought.com/article/138-code-change-banner-heading-size-for-mobile