Skip to content

Instantly share code, notes, and snippets.

@josephdickson
Created October 18, 2018 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephdickson/002e010deac5f67ac53bd28e02875f36 to your computer and use it in GitHub Desktop.
Save josephdickson/002e010deac5f67ac53bd28e02875f36 to your computer and use it in GitHub Desktop.
Add to functions.php to customize font size options
<?php
add_action( 'wp_enqueue_scripts', 'twenty_seventeen_gutenberg_enqueue_styles' );
// Font size options
function mytheme_setup_theme_supported_features() {
add_theme_support( 'editor-font-sizes', array(
array(
'name' => __( 'extra small', 'themeLangDomain' ),
'shortName' => __( 'xs', 'themeLangDomain' ),
'size' => 10,
'slug' => 'extrasmall'
),
array(
'name' => __( 'small', 'themeLangDomain' ),
'shortName' => __( 's', 'themeLangDomain' ),
'size' => 12,
'slug' => 'extrasmall'
),
array(
'name' => __( 'regular', 'themeLangDomain' ),
'shortName' => __( 'R', 'themeLangDomain' ),
'size' => 16,
'slug' => 'regular'
),
array(
'name' => __( 'medium', 'themeLangDomain' ),
'shortName' => __( 'M', 'themeLangDomain' ),
'size' => 24,
'slug' => 'medium'
),
array(
'name' => __( 'large', 'themeLangDomain' ),
'shortName' => __( 'L', 'themeLangDomain' ),
'size' => 28,
'slug' => 'large'
),
array(
'name' => __( 'larger', 'themeLangDomain' ),
'shortName' => __( 'XL', 'themeLangDomain' ),
'size' => 36,
'slug' => 'larger'
)
) );
// Add Pitzer Orange to the color palette block
add_theme_support( 'editor-color-palette', array(
array(
'name' => __( 'Pitzer Orange', 'themeLangDomain' ),
'slug' => 'pitzer-orange',
'color' => '#f7941d',
),
) );
}
add_action( 'after_setup_theme', 'mytheme_setup_theme_supported_features' );
@josephdickson
Copy link
Author

Custom code to adjust font sizes available in the Gutenberg paragraph block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment