• Hello I try to change the breakpoints settings. It is exactly this question: Breakpoints question

    I put the snippet in my functions.php theme file. Is it possible that it is not working anymore? Still 767px as default..

Viewing 1 replies (of 1 total)
  • Plugin Support Alvind

    (@alvindcaesar)

    Hi there,

    The snippet in that topic only works for GB v1 — it won’t work with v2 blocks.

    For v2 use this snippet instead:

    add_action( 'enqueue_block_editor_assets', function() {
    $overrides = [
    'largeWidth' => '@media (min-width:1280px)', //desktop
    'mediumWidth' => '@media (max-width:1279px) and (min-width:768px)', //tablet
    'mediumSmallWidth' => '@media (max-width:1279px)', //tablet & mobile
    'smallWidth' => '@media (max-width:768px)', //mobile
    ];

    $script = sprintf(
    'wp.hooks.addFilter(
    "generateblocks.styles.defaultAtRules",
    "my-theme/modify-default-at-rules",
    function( atRules ) {
    const overrides = %s;
    return atRules.map(rule => ({
    ...rule,
    value: overrides[rule.id] || rule.value
    }));
    }
    );',
    json_encode( $overrides )
    );

    wp_add_inline_script( 'generateblocks-styles-builder', $script, 'before' );
    });

    Important: this change only affects newly inserted v2 blocks. Existing blocks that were added before the snippet won’t have their breakpoints changed automatically. 

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.