Last active
November 27, 2024 10:27
-
-
Save wpmark/aa2469de4804a7a01883a13d37051ef9 to your computer and use it in GitHub Desktop.
Revisions
-
wpmark revised this gist
Nov 26, 2024 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,17 +2,17 @@ /** * Register some default block editor styles for this block. */ function hd_register_block_styles() { // add the small image style. register_block_style( 'core/heading', // name of your block array( 'name' => 'eyebrow', // part of the class that gets added to the block. 'label' => __( 'Eyebrow Heading' ), ) ); } add_action( 'init', 'hd_register_block_styles' ); -
wpmark revised this gist
May 6, 2022 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ # Register block styles with PHP You can now register different styles for WordPress blocks using PHP - no Javascript needed! Use the code here, either in your themes `functions.php` file or a plugin. The `name` paramter forms part of the CSS class that is added to the block. Don't forget, this is all that block styles do, they had an additional class which then allows you to style them in a different way. The class will take the form of `is-style-{NAME}`. So in the example here, when the "EyeBrow" style is applied to a heading, that heading block would have the class of `is-style-eyebrow`. -
wpmark created this gist
May 6, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ <?php /** * Register some default block editor styles for this block. */ function hd_testimonials_register_testimonials_block_styles() { // add the small image style. register_block_style( 'core/heading', // name of your block array( 'name' => 'eyebrow', // part of the class that gets added to the block. 'label' => __( 'Eyebrow Heading', 'hd-testimonials' ), ) ); } add_action( 'init', 'hd_testimonials_register_testimonials_block_styles' );