[Resolved] Reduce Size of a Block Within Block Editor

Home Forums Support [Resolved] Reduce Size of a Block Within Block Editor

Home Forums Support Reduce Size of a Block Within Block Editor

Viewing 3 posts - 16 through 18 (of 18 total)
  • Author
    Posts
  • #2144790
    Fernando
    Customer Support

    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! 🙂

    #2144794
    Math

    Awesome! Thanks again for helping me resolve this issue!!

    #2144800
    Fernando
    Customer Support

    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. 🙂

Viewing 3 posts - 16 through 18 (of 18 total)
  • You must be logged in to reply to this topic.