• Resolved amarettosour

    (@amarettosour)


    I’m trying to filter the fonts displaying in the typography field. The following code shows the correct choices in the dropdown, but selecting them does not load the font.

    	$fields[] = array(
    		'type'        => 'typography',
    		'settings'    => 'font_body',
    		'label'       => esc_attr__( 'Body Font', 'sage' ),
    		'section'     => 'typography_general',
    		'default'     => array(
    			'font-family'    => 'PT Serif',
    			'line-height'    => '1.8',
    			'variant'        => 'regular',
    			'font-size'		 => '16px',
    			'letter-spacing' => '0',
    			'subsets'        => array( 'latin-ext' ),
    		),
    		'choices'  => array(
    			'fonts' => array(
    				'google' => array('Lato', 'Playfair Display', 'PT Serif'),
    			),
    		),
    		'priority'    => 10,
    		'output'      => array(
    			array(
    				'element' => 'body',
    			),
    		),
    		'transport'   => 'auto',
    	);
    

    Secondly, is it possible to add custom fonts to the typography dropdown (e.g. from fontsquirrel) or will I be better off using the select field?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Filtering google fonts’ is closed to new replies.