Questions tagged [gutenberg-blocks]

515 questions
14
votes
3 answers

Gutenberg - Multiple InnerBlocks in one block-type

I am trying to make custom columns block since the wordpress default used by gutenberg is not what I need. So i have looked up how it works, its uses InnerBlocks block with a layout definition, but there is no way to specify the html tag and the…
Erik Kubica
  • 1,180
  • 3
  • 15
  • 39
12
votes
3 answers

WordPress Gutenberg: This block contains unexpected or invalid content

I am creating very simple text block. The block works fine when I add this for the first time. If I refresh the page and try to edit the block it show me the message "This block contains unexpected or invalid content.". I have tried to disable…
11
votes
2 answers

Wordpress Gutenberg: React components on front end

Gutenberg is still pretty new, but I'm still hoping someone has encountered this issue and found a solution. I've used create-guten-block to boilerplate a project and created a test block. The problem I'm running into is that when I try to use a…
iskotaa
  • 123
  • 1
  • 10
8
votes
2 answers

Block.json returnes wrong paths

I've created a custom block plugin with @wordpress/create-block (https://developer.wordpress.org/block-editor/reference-guides/packages/packages-create-block/) It works as a plugin, but when i move it into the theme, the "editorScript" in the…
Jonatanbs
  • 223
  • 2
  • 9
8
votes
2 answers

Gutenberg editor scroll block into view

How can I scroll a newly inserted block into the view in the wordpress gutenberg editor? I am creating the block with const nextBlock = createBlock( 'core/paragraph' ); wp.data.dispatch( 'core/editor' ).insertBlock( nextBlock ); //scroll the block…
niklas
  • 2,887
  • 3
  • 38
  • 70
8
votes
2 answers

How to "manually" (programmatically) insert a block in Gutenberg?

Gutenberg's API is quiet obscure and I can't figure how to create and append a block to a post. I've found the wp.blocks.createBlock('core/paragraph', {content: "blabla"}); which returns a pretty block object, but does not append any content to the…
7
votes
2 answers

Add custom block in a Wordpress block theme(Not with the plugin)

Basically I want to develop a wordpress block theme.For easy to customize I want to add some custom block in my theme.But I don't want to create a plugin for this.Custom block will be inside my theme.When someone install my theme he will get those…
7
votes
2 answers

Type a tab character into a Gutenberg Code block

The Gutenberg Code blocks are for display blocks of code within your WordPress posts and pages. In ideal situations, most people just copy and paste code directly into these blocks. But I'd like to be able to just type the code into the block. How…
7
votes
0 answers

Wordpress Gutenberg ACF Blocks How to Add JS When Block is Opened

I'm using ACF Blocks and have the following block. acf_register_block_type(array( 'name' => 'columns', 'title' => __('Columns'), 'description' => __('For complex multi colomn rows.'), // 'category' …
Jon
  • 295
  • 2
  • 11
7
votes
5 answers

Get reusable block in php

For the life of me, I can't find anything on how to do this: simply output a reusable gutenberg block via php in a theme template. Seems like it should be doable. Anyone?
protohominid
  • 593
  • 5
  • 18
6
votes
3 answers

Add product attribute to Woocommerce's blocks in Gutenberg

EDIT I: I have found the file where the old plugin Woocommerce Blocks sets the blocks: https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/master/src/BlockTypes/FeaturedCategory.php But where is it in the Woocommerce…
6
votes
1 answer

Getting attributes of InnerBlocks and saving them to parent

I have created a "Tabbed Panels" (tabbed content) block that is essentially just an InnerBlocks component that only allows the block "Panel". When you create a Panel you must give the Panel a heading which is then used in the Panel as well as the…
Rice_Crisp
  • 1,242
  • 1
  • 16
  • 33
6
votes
2 answers

How to insert Gutenberg block inside post_content when using wp_insert_post()?

I would like to generate a Gutenberg block in PHP. I'm currently developing a WordPress plugin that import videos from YouTube and create a post for each video. I can insert the YouTube video inside the post_content but when i edit the post with the…
Olivier
  • 95
  • 2
  • 11
6
votes
2 answers

How to use "getEntityRecords" for specific taxonomy terms

I'm trying to use "getEntityRecords" to get custom post types from specific terms of taxonomy. For "post" I can use "categories" attribute in "query" object, like below: getEntityRecords( 'postType', 'post', {per_page: 3, categories: [1,2,3] }…
6
votes
1 answer

Firing Wordpress Gutenberg "Convert to Blocks" programmatically

I have several robots, written in Node.js, to auto-generate HTML contents and put them into several Wordpress sites using REST API. Recently Wordpress 5.0 has been officially released, and Gutenberg has become the default editor. All the old posts,…
kychung
  • 73
  • 6
1
2 3
34 35