Archived topic
Reduce Size of a Block Within Block Editor
17 replies · Started by Math on March 2, 2022
Glad that you were able to find a solution. If you’ll need to include other pages, then you can try doing it as such:
add_action( 'enqueue_block_editor_assets', function() {
if(get_the_ID() == 13508 || get_the_ID() == 13509){
wp_enqueue_style( 'my-block-editor-styles', get_stylesheet_directory_uri() . "/editor-style.css", false,'1.0', 'all' );
}
} );
The || operator denotes an OR logical operator. In short the code above say if the ID of the page is 13508 OR 13509, then run the code. If you'll have more, you can simply add more ||.
See this for reference: https://www.php.net/manual/en/language.operators.logical.php
Hope this clarifies! :)
Awesome! Thanks again for helping me resolve this issue!!
You’re welcome! Glad to be of assistance.
In any case, you may also replace == with === as WordPress prefers strict comparisons. Example:
add_action( 'enqueue_block_editor_assets', 'my_function' );
function my_function() {
if ( 13508 === get_the_ID() || 13509 == get_the_ID() ) {
wp_enqueue_style( 'my-block-editor-styles', get_stylesheet_directory_uri() . "/editor-style.css", false, '1.0', 'all' );
}
}
Hope this helps! Feel free to reach out anytime if you’ll need assistance with anything else. :)