WordPress Block Variation for Gallery Columns

I had this code to extend the column count to 10 for a specific need.

wp.blocks.registerBlockVariation('core/gallery', {
  name: 'prefix-gallery',
  title: 'Custom Gallery',
  attributes: {
    columns: 10,
  },
  isDefault: true,
});

But that doesn’t seem to work any longer. I see the updated Block Gallery attributes has this:

attributes: {
  {
    columns: {
      "type": "number",
      "minimum": 1,
      "maximum": 10,
    },
  },
}

So I tried:

wp.blocks.registerBlockVariation('core/gallery', {
  name: 'prefix-gallery',
  title: 'Custom Gallery',
  attributes: {
    columns: {
      minimum: 1,
      maximum: 10,
    },
  },
  isDefault: true,
});

That doesn’t seem to work to extend the column count to 10.

Anyone now how to adjust the block variation to 10 instead of the default 8?

0

Leave a Comment