Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #341947

    Hi folks, this is my first post after reading quite a lot. I’ve done some thorough searching but I’m having no luck, in spite of the similar posts.

    I’m seeking to add a custom web font, Verb Condensed, to my Enfold site to use across header and body styles, and generally throughout the site. I’m familiar with the @font-face protocol, and I have that working on my current website which does not use Enfold.

    Here’s what I’ve done so far:

    1. Uploaded the web font files (EOT, SVG, TTF, and WOFF) to a folder within my “enfold-child” folder called css/webfonts/
    2. I updated the styles.css in the Child Theme to include those. Here’s a sample:

    @font-face {
    	font-family: 'VerbCond Light Italic';
    	src: url('css/webfonts/verbcond-light-italic.eot');
    	src: url('css/webfonts/verbcond-light-italic.eot?#iefix') format('embedded-opentype'),
    	     url('css/webfonts/verbcond-light-italic.woff') format('woff'),
    	     url('css/webfonts/verbcond-light-italic.ttf') format('truetype'),
    	     url('css/webfonts/verbcond-light-italic.svg#ywftsvg') format('svg');
    	font-weight: normal;
    	font-style: normal;	}	

    3. I’ve added another line in the styles.css file to give some of the site styles the ‘VerbCond’ typeface

    body {
    font-family: 'VerbCond Regular', sans-serif !important; 
    }	

    The result is that everything appears as Helvetica. It seems to be half-working, in that I’ve stripped the formatting from the drop-down menus within Theme Options > General Styling > General, but it’s not recognizing the Verb Condensed files I’ve uploaded. The site is also very slow to load.

    Can anyone advise how to sort this out? I know you get this question a lot, in slightly different forms, so appreciate your insight.

    Should I make modifications to a different CSS file aside from styles.css? Should I upload the font files to a different folder location? Is there a reason I should only use fontsquirrel or some other protocol?

    If possible, I’d like to add Verb Condensed to the drop-down menu so I can simply select it, rather than having to write a custom style for every use case.

    #342596

    Hey!

    Try adding this at the very end of your theme / child theme functions.php file:

    add_filter( 'avf_google_content_font',  'add_custom_font');
    add_filter( 'avf_google_heading_font',  'add_custom_font');
    function add_custom_font($fonts) {
    	$fonts['VerbCond Regular'] = 'VerbCond Regular';
    	return $fonts;
    }
    

    That should make appear the “VerbCond Regular” font in the Theme Options dropdowns, but it will only work if the @font-face inclusion is working correctly.

    Cheers!
    Josue

    #342759

    Hi Josue,

    The code bits did add VerbCond Regular to the drop-down list. Thanks for the advice! But unfortunately the @font-face is still not working.

    I have used Verb Condensed on another WordPress website with a different, more basic, theme. It was a very straightforward process, which is why it’s so frustrating here. My first thought is that it’s something to do with the Child Theme, since I don’t have one on the other site. Should I modify my main Enfold files? Or is there something wrong with my CSS to begin with?

    The drop-down thing is a nice little bonus, but I appreciate any insight into the main question — how to get an outside webfont to load. I see this is a common question, but unfortunately none of the straightforward solutions presented seem to work for me.

    #342772

    Ok, quick update. I seem to have solved the @font-face issue by changing the CSS so the URL is an absolute link to the font files … on my other website! Here’s the code:

    @font-face {
    	font-family: VerbCond Regular;
    	src: url(https://busycreator.com/wp-content/themes/Busy%20Creator%201.0/css/webfonts/verbcond-regular.eot);
    	src: url(https://busycreator.com/wp-content/themes/Busy%20Creator%201.0/css/webfonts/verbcond-regular.eot?#iefix) format('embedded-opentype'),
    	     url(https://busycreator.com/wp-content/themes/Busy%20Creator%201.0/css/webfonts/verbcond-regular.woff) format('woff'),
    	     url(https://busycreator.com/wp-content/themes/Busy%20Creator%201.0/css/webfonts/verbcond-regular.ttf) format('truetype'),
    	     url(https://busycreator.com/wp-content/themes/Busy%20Creator%201.0/css/webfonts/verbcond-regular.svg#ywftsvg) format('svg');
    	font-weight: normal;
    	font-style: normal;	}

    As you can see, I’m linking to the files on http://busycreator.com. The same files are indeed uploaded to my Enfold site, but for some reason I can make a reference to the relative files. I’d prefer to keep this as a relative URL in case I have to make future updates or move the same code to another installation. Should I redirect to a parent directory, such as ../enfold/ rather than within the /enfold-child/ folder?

    I’ll stick with the workaround for now, but I’d love if someone persnickety could examine my CSS and advise. Thanks for your help so far.

    #342806

    You are welcome, alternatively you can use a plugin solution for the @font-face inclusion, like WP Font Face.

    Regards,
    Josue

    #343817

    To follow up, I managed to use a relative URL, but it required I move the /webfonts/ folder outside of both the child theme and main enfold folder and put it directly in /wp-content/. Not sure why that worked, but it seems to be the trick to a relative URL in the CSS.

    #343835

    In that case you could create a “/fonts” folder in the root of the installation so you don’t have to alter the wp-content structure.

    Regards,
    Josue

    #349630

    I’m having exactly the same problem however none of the solutions posted here have worked for me.

    If you move the fonts folder into the root of the installation, you should be able to access with /fonts as the URL, correct? Tried this and it’s not working either.

    Any suggestions would be appreciate. This is driving me insane.

    #349631

    Hi,

    Can you post the link to your website please? FTP and Dashboard access may be needed too.

    Regards,
    Josue

    #349632
    This reply has been marked as private.
    #349641

    Hi!

    Font inclusion is working, the problem resides in the font declaration, for example:
    The font it’s declared like this in @font-face:

    font-family:"ITCFranklinGothicW01-Dm_812677";
    

    But It’s like this down below:

    font-family:"ITCFranklinGothicW01-Dm 812677";
    

    Make sure it is exactly the same in all iterations.

    Best regards,
    Josue

    #349674

    Thank you so much for catching that. Been banging my head against the wall for hours.

    #349700

    You are welcome, always glad to help :)

    Regards,
    Josue

    #517312

    Thank for the help, I works great for me, but now how can I change the font size?

    I tried to add

    .h1{
    font-size: 124pt !important;
    }

    to te custom css, but it doesn’t work.

    thanks

    #517372

    Hi!

    Please change your code to following one

    h1{
    font-size: 124pt !important;
    }

    Regards,
    Yigit

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.