Skip to content

Instantly share code, notes, and snippets.

@landbryo
Created December 20, 2023 18:19
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 landbryo/053cd0006f89257f9cbfc6cfde062ba8 to your computer and use it in GitHub Desktop.
Save landbryo/053cd0006f89257f9cbfc6cfde062ba8 to your computer and use it in GitHub Desktop.
Enable the dropcap feature by modifying the theme.json
<?php
/**
* Add drop cap support to the theme.json file.
*
* @param array $theme_json The theme.json json.
*
* @link https://developer.wordpress.org/block-editor/developers/themes/theme-json/#typography
*/
add_filter( 'wp_theme_json_data_theme', function( $theme_json ) {
$json = $theme_json->get_data();
$json['settings']['typography'] = [ 'dropCap' => true ];
return $theme_json->update_with( $json );
}, 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment