Support » Fixing WordPress » editor-font-sizes in functions not working (Gutenberg)

  • Resolved James

    (@bonkerz)


    Hey
    I am using editor-font-sizes in my functions.php but it doesn’t take affect.

    I’ve already added custom color palette, but having issues with this:

    add_theme_support( 'editor-font-sizes', array(
    	array(
    		'name' => __( 'extra small', 'platetheme' ),
    		'shortName' => __( 'XS', 'platetheme' ),
    		'size' => 11,
    		'slug' => 'small'
    	),
    	array(
    		'name' => __( 'regular', 'platetheme' ),
    		'shortName' => __( 'M', 'platetheme' ),
    		'size' => 16,
    		'slug' => 'regular'
    	),
    	array(
    		'name' => __( 'large', 'platetheme' ),
    		'shortName' => __( 'L', 'platetheme' ),
    		'size' => 36,
    		'slug' => 'large'
    	),
    	array(
    		'name' => __( 'larger', 'platetheme' ),
    		'shortName' => __( 'XL', 'platetheme' ),
    		'size' => 50,
    		'slug' => 'larger'
    	)
    ) );

    I’ve tried to disable custom font sizes to see if that was a requirement (the code works just doesn’t help with the above)

    add_theme_support('disable-custom-font-sizes');

    Any idea why it isn’t working on the editor?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @bonkerz,

    Are they showing up within Gutenberg, but just not working on the front-end? If so, you may just need to add the relevant font-size classes, like this.

    Let me know if that fixes it. 💪

    Rich! Thanks so much for replying. I’ve realised that the code I was using did work. However I was expecting it to look like the below screenshot (with S M L XL buttons), instead it’s a select box. As I was only looking for the buttons to show, I never realised that the select box was being changed/updated with my code. All good!

    P.S. Love your work on Coblocks! You are doing great shiz 👏

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘editor-font-sizes in functions not working (Gutenberg)’ is closed to new replies.