Adding a custom font to BB theme

Hi Michael. I am still working on a tutorial for how to do this. After you add the TypeKit code (I usually add it to the header), you’ll also need to add a line or two of CSS to apply it to the page.

To use the font on the entire site, you’d want to use the body tag:

body {
  font-family: 'proxima-nova', sans-serif;
}

You can also just target headings with this line of code:

h1, h2, h3, h4, h5, h6 {
  font-family: 'proxima-nova';
}

You’ll need to change the font name depending on what font you’re using (the examples use Proxima Nova). You can find the font family name in your kit settings. In the Weights & Styles section, there is a link labeled: Using weights & styles in your CSS. Clicking that link will display the font family name to use in CSS.

I will get a full fledged tutorial with screen shots and all on how to do this soon. For now, though, let me know if you have any other questions!

Hello,

So, I am just trying to make sure I am understanding correctly here, we have to enqueue the font we want before calling it on CSS.

For some reason, I was thinking that Google Web Fonts were accessible in general? I was thinking it was an include in the header to a google file to have the fonts available?

I am pretty confused right now. Did you ever get a chance to build that tutorial for this?

thanks guys. having google fonts readily available would be a nice feature for my sites, so I am looking forward to learning how to set this up properly.

-bryan

Hey Bryan! Are you using the Beaver Builder theme? The ability to include/load Google fonts is built in to the Beaver Builder Theme. You can select fonts in the theme customizer. You would only need to enqueue/load them if you are using another font service like TypeKit.

Yes, I am using the BB theme. so maybe I am just not doing something write.

I named a class for the header module that I am wanting to use:

home-lead-h1

then I added this to the custom css:
.home-lead-h1 {
font-family: ‘Lora’, serif;
font-size: 48px;
}

Did I miss a step?

Bryan, you’ll need to set the fonts you want to use in the Theme Customizer. You can choose a font for the body and a font for headings. You don’t need to set them in CSS if you choose them in the customizer. If you want to use more than one font for either the headings or body, then you would need to enqueue the additional font(s) in your code.

I see what you are saying now.

I can choose one font for heading and one font for text, but if I wanted to use any additional fonts (not that it would be a good idea to do that) I would have to enqueue them first.

that makes sense. thanks for the clarification.
-bryan

Sure! No problem. Let me know if you have any more questions. Thanks, Bryan!

Hey guys. If anyone is still following this thread, I finished up the TypeKit tutorial for our Knowledge Base:

http://forum.wpbeaverbuilder.com/knowledge-base/loading-using-typekit-fonts/

Let me know if I missed anything!

A quick note that may help others - the Captain Typekit plugin makes it easy to add Typekit fonts to your site. All you need is the Typekit ID.

The cool thing about it is it shows you the fonts available in the kit as well as their weights.

Good find, Kieth! Thanks for letting us know about that one!

I need to add a custom font to my BB theme and have tried using both the suggestions from Robby and Dennis independently. Either way, my custom font is still not available in the theme customizer. Any suggestions?

Hey Ben! These methods will load a web font and allow you to use it with CSS. Unfortunately, there’s no easy way to include custom fonts in the Customizer. It might be possible with some custom code, though. If there’s a filter or action that we could add to make it possible, definitely let us know.

Thanks for the reply Robby. So assuming i’ve followed your first post, i’ve added the function to enqueue the new font, i’ve called the font in my function.php file and i’ve updated my style.css to call the new font. How do i now apply the font to some text on the site? I assume i need to use some CSS selectors in the advanced tab of the text editor, but if so, how do i know what the class and ID are?

Apologies, new to this.

Ben,
Don’t apologize - we’re all here to learn from each other :slight_smile:
It’s worth trying this plugin Use Any Font - I’ve tested it and it seems to work. Also it’s only $10-$20 to get Pro license where you can use unlimited fonts.

No worries at all. You’re correct that you would need to target an element with CSS and set the font that way.

This isn’t the best practice, but you could try something like this:

.bens-class {
  font-family: [your font], sans-serif !important;
}

The important tag will override any other styles. Then, in the page builder, for any module that you want to use the font, you can add the class bens-class in the advanced tab.

And or, the plugin above might be the easiest route. :slight_smile:

Thanks Dennis and Robby, both super helpful responses :slight_smile:

If you’re still looking for a way to inject your custom fonts into the theme customizer, this solution works for me:
https://www.warpconduit.net/2016/02/15/adding-custom-fonts-to-the-beaver-builder-child-theme-customizer/

if anyone is still following this thread, the above solution absolutely works. very quick and easy

Hey Seth,

Thanks for taking the time to let us know! :slight_smile:

Enjoy!

Ben