Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

196
Visualizações
WordPress: Add aligncenter to Gutenberg groups block

Per default, the Gutenberg groups block has only two alignment options: wide and full width.

I now want to add a custom alignment center to the block. Other blocks like images have this option.

Is there any way to extend a core block like this?

I know that there is an option for custom styles with registerBlockStyle (See docs).

But is there also something like this for basic controls/settings? I couldn't find anything in the docs.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I found an answer here.

It works, if I change the code like this:

wp.hooks.addFilter( 'blocks.registerBlockType',
  'my/change_alignment', ( settings, name ) => {

  switch( name ) {
    case 'core/group':
    case 'core/cover':
      return lodash.assign( {}, settings, {
        supports: lodash.assign( {}, settings.supports, {
          align: [ 'center', 'wide', 'full']
        } ),
      } );
  }

  return settings;
});
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda