Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1319543

    I am having an issue with Work Sans. I want to use the 200 and the 300 but I seem to only be getting the 100 and the 400. I uploaded the Google font for the 300. I also tried the 2 additions to the CSS detailed in this thread:

    @import url(‘https://fonts.googleapis.com/css2?family=Work+Sans:wght@300&display=swap’);

    add_filter( ‘avf_google_heading_font’, ‘avia_add_content_font’);
    add_filter( ‘avf_google_content_font’, ‘avia_add_content_font’);
    function avia_add_content_font($fonts)
    {
    $fonts[‘Work Sans’] = ‘Open Sans:200,300, 400’;
    $fonts[‘Work Sans’] = ‘Open Sans:200,300, 400’;
    return $fonts;
    }

    Right now I have selected Work Sans as the heading and body font in General Styling and used Advanced Styling to select the 300 version but I am getting the 100.

    Thanks in advance for the guidance.

    #1319815

    Hey tiffanytnttobol,

    Thank you for the inquiry.

    The code above is actually assigning the Open Sans font and its variation to the Work Sans option in the backend. You have to adjust the code a bit.

    function avia_font_mod($fonts){
    	$fonts['Work Sans New'] = 'Work Sans:100,200,300,400,600,700';
    	return $fonts;
    }
    add_filter( 'avf_google_heading_font', 'avia_font_mod');
    add_filter( 'avf_google_content_font', 'avia_font_mod');
    

    Make sure to select Work Sans New in the font drop down.

    Best regards,
    Ismael

    #1319917

    by the way : Work Sans is one of those nice variable fonts offered by Google.
    i do always tranform those ttf to woff2 fonts. See here some infos: https://web.dev/variable-fonts/

    #1320060

    Hi,

    Thanks for sharing @guenni007 :-)

    Best regards,
    Rikard

    • This reply was modified 3 years, 3 months ago by Rikard.
    #1321103

    Thank you for your help. I added that code to the CSS box under General Styling and I am not getting an option in the font dropdown for Work Sans New.

    #1321286

    first – the new added fonts are on the bottom of the list – not in alphabetical order!
    Now – i guess the filter for the content font is now: avf_available_google_fonts ( since Enfold 4.3 )
    btw : i do see on Google now the variable font only

    #1321329

    Hi,

    @tiffanytnttobo: You have to add the code in the functions.php file.


    @Guenni007
    : In the filter above, we are actually appending or pushing the new font in the end of the array, which is why the new font is located at the bottom of the list. We might be able to adjust the order of the fonts by re-sorting the $fonts array.

    Best regards,
    Ismael

    #1321346

    It was just my intention to mention this here – because many participants say it’s not there because they don’t scroll to the bottom of the dropdown list.

    PS : does the old filter still work? have you changed the backward compatible?
    that new filters seems to work for both lists ( heading and content)

    #1321571

    Hi,

    Yes, looks like the old filter is still in place within the enfold/framework/php/font-management/class-avia-type-fonts.php file.

    	/**
    		 * Kept for backwards compatibility - will be replaced by next filter
    		 */
    		$fonts = apply_filters('avf_google_heading_font', $fonts );
    
    		/**
    		 * @since 4.3
    		 * @return array
    		 */
    		$fonts = apply_filters('avf_available_google_fonts', $fonts );
    

    Best regards,
    Ismael

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