• Resolved jmslbam

    (@jmslbam)


    Thank you for th plugin!

    Can’t find it in the documentation, but is it possible to set the default unit to “em” instead of “px” via code?

    Kind regards,

    Jaime

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Andrea Gandino

    (@andg)

    Hi Jaime,

    thank you for using Grids!

    We’ve just released an update to Grids (version 1.2.28) that allows developers to change the units being used in size controls in Sections and Areas through a filter in your plugin or theme.

    For example:

    add_filter( 'grids/config', function( $config ) {
    	$config[ 'general' ][ 'size_units' ] = array(
    		array( 'label' => 'em', 'value' => 'em' ),
    		array( 'label' => 'px', 'value' => 'px' ),
    		array( 'label' => '%', 'value' => '%' ),
    		array( 'label' => 'rem', 'value' => 'rem' ),
    		array( 'label' => 'vh', 'value' => 'vh' ),
    		array( 'label' => 'vw', 'value' => 'vw' ),
    	);
        
    	return $config;
    } )

    Putting the ems array as first item in the configuration array will make it the default one when creating a new section with Grids.

    Please refer to the config.php file in the main folder of Grids to get a list of available configuration options.

    Thread Starter jmslbam

    (@jmslbam)

    Thank you for the quick reply! Will check config.php out.

    Ciao Jaime!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Seeting default unit on “em”’ is closed to new replies.