Created
June 4, 2021 04:06
-
-
Save justintadlock/70180c2019f1e2dbdda96ee263610671 to your computer and use it in GitHub Desktop.
Offset left and right Cover block styles
This file contains 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 characters
<?php | |
add_action( 'init', function() { | |
register_block_style( 'core/cover', [ | |
'name' => 'offset-left', | |
'label' => __( 'Offset Left' ), | |
'inline_style' => | |
'.wp-block-cover.is-style-offset-left > .wp-block-cover__inner-container { | |
background-color: inherit; | |
color: inherit; | |
padding: inherit; | |
} | |
@media ( min-width: 768px ) { | |
.wp-block-cover.is-style-offset-left > .wp-block-cover__inner-container { | |
width: 75%; | |
margin-left: -75%; | |
} | |
}' | |
] ); | |
register_block_style( 'core/cover', [ | |
'name' => 'offset-right', | |
'label' => __( 'Offset Right' ), | |
'inline_style' => | |
'.wp-block-cover.is-style-offset-right > .wp-block-cover__inner-container { | |
background-color: inherit; | |
color: inherit; | |
padding: inherit; | |
} | |
@media ( min-width: 768px ) { | |
.wp-block-cover.is-style-offset-right > .wp-block-cover__inner-container { | |
width: 75%; | |
margin-right: -75%; | |
} | |
}' | |
] ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment