• Resolved mrcangrejero

    (@mrcangrejero)


    I’m using EGF with the instructions you provided here. So far, no problem until I attempt to change “font-size”.

    As an example, this is a partial portion of my code:

    $controls[‘theme_title_control’] = array(
    ‘name’ => ‘theme_title_control’,
    ‘title’ => ‘Header Title Control’,
    ‘tab’ => ‘theme-header’,
    ‘properties’ => array(
    ‘selector’ => ‘.site-title a’
    ),
    ‘default’ => array(
    ‘font_color’ => ”,
    ‘font_size’ => array( ‘amount’ => 4, ‘unit’ => ’em’ ),
    ),
    );

    As you will appreciate, I have set a default font size of 4em. When I open the Customizer and go to Appearance ==> Font Size, the 4em value appears and is applied. However, when I try to change this value with the slider, the slider erases the 4em value and gives me a value range from 10em to 100em. Hitting reset doesn’t bring the 4em value back. How can I change this behavior so that the range is 0.5em to 10em. Any guidance appreciated. Thanks!

    https://www.ads-software.com/plugins/easy-google-fonts/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Sunny Johal

    (@sunny_johal)

    Hi,
    In your example you would do something like the following:

    $controls['theme_title_control'] = array(
    	'name'       => 'theme_title_control',
    	'title'      => 'Header Title Control',
    	'tab'        => 'theme-header',
    	'properties' => array(
    		'selector'            => '.site-title a',
    		'font_size_min_range' => 0.5,
    		'font_size_max_range' => 10,
    		'font_size_step'      => 0.5,
    	),
    	'default'    => array(
    		'font_color' => '',
    		'font_size'  => array( 'amount' => 4, 'unit' => 'em' ),
    	),
    );

    Take a look at the parse_font_control_array() function on line 536 in file includes/class-egf-register-options.php to see all of the properties and selectors that you can define for each control. Hope that helps. Cheers

    Sunny

    Thread Starter mrcangrejero

    (@mrcangrejero)

    Dear Sunny:
    Like your plugin, the code above worked like a charm. I really appreciate you taking the time to help me. Yours is one of the few plugins that I have felt I have to donate to. As soon as my social security check come in, I’ll do so. In the mean time, the best to you and yours, and thanks, again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Font Size’ is closed to new replies.