Update Editor Block Font Size Options

Place the below in your functions.php to add your own custom font options to the core Paragraph Block.Update the names and sizes as you see fit. More size options can be added by copying the array details.

// Adds support for editor font sizes.
add_theme_support( 'editor-font-sizes', array(
	array(
		'name'      => __( 'Small', 'relish-brand' ),
		'shortName' => __( 'S', 'relish-brand' ),
		'size'      => 16,
		'slug'      => 'small'
	),
	array(
		'name'      => __( 'Normal', 'relish-brand' ),
		'shortName' => __( 'N', 'relish-brand' ),
		'size'      => 22,
		'slug'      => 'regular'
	),
	array(
		'name'      => __( 'Large', 'relish-brand' ),
		'shortName' => __( 'L', 'relish-brand' ),
		'size'      => 36,
		'slug'      => 'large'
	),
	array(
		'name'      => __( 'Huge', 'relish-brand' ),
		'shortName' => __( 'XL', 'relish-brand' ),
		'size'      => 48,
		'slug'      => 'huge'
	)
) );

This will update the core Paragraph block as follows:

core paragraph block with custom font sizes

Source.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.