Adding Custom Font Family to Font dropdown

I saw somewhere on the web that one can add custom font families to the Typography fonts list using add_filter(‘x_fonts_data’, ‘my_custom_font’) etc. I havent been able to do so successfully. Is there any documentation or is this not supported.

I would really want to be able to use the Font Manager with my custom fonts that I include with my child theme or everything is more messy trying to use classes to assign fonts everywhere.

Thanks.

This was my code:

    function my_custom_font($data){

      $data['mywebfont1'] = array(
              'source'  => 'Custom',
              'family'  => 'Avenir Light',
              'stack'   => 'AvenirLTStd-Light, sans-serif',
              'weights' => array( '300' )
            );
     array_push($data, $data['mywebfont1']);

     $data['mywebfont2'] = array(
              'source'  => 'Custom',
              'family'  => 'Acta Display Black',
              'stack'   => 'ActaDisplay, serif',
              'weights' => array( '900' )
            );
     array_push($data, $data['mywebfont2']);
     return $data;
      
    }
    add_filter('x_fonts_data', 'my_custom_font');

Hi Calvin,

Unfortunately, it is not possible and the code that you see is for the old system and not the new Font Manager. You will need to assign the fonts to any other WordPress website with custom CSS code.

Thank you for your understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.