Skip to content

Instantly share code, notes, and snippets.

@odil-io
Created August 19, 2021 09:21
Show Gist options
  • Save odil-io/ce5afa679ee41bb5a16ef68f05e07cd1 to your computer and use it in GitHub Desktop.
Save odil-io/ce5afa679ee41bb5a16ef68f05e07cd1 to your computer and use it in GitHub Desktop.
Gutenberg: Add custom font sizes
<?php
function namespace_define_font_sizes() {
add_theme_support(
'editor-font-sizes',
[
[
'name' => __( 'Small', 'namespace' ),
'size' => 16,
'slug' => 'namespace-small',
],
[
'name' => __( 'Regular', 'namespace' ),
'size' => 20,
'slug' => 'namespace-regular',
],
[
'name' => __( 'Large', 'namespace' ),
'size' => 24,
'slug' => 'namespace-large',
],
]
);
}
add_action( 'after_setup_theme', 'namespace_define_font_sizes' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment