Questions tagged [gutenberg-blocks]

515 questions
3
votes
1 answer

Modifying or adding classes to individual components within core wordpress blocks

I am having difficulty modifying or adding additional classes to individual components of wordpress blocks. I essentially just want to add a class or classes to some of the pieces that make up some of the core wordpress blocks to do things like add…
3
votes
1 answer

Gutenberg InnerBlocks pass props or get info

I am just getting into Gutenberg and especially InnerBlocks. What I am trying to achive is a form of communication between parent- and inner blocks. I would e.g. love to display, how many inner blocks are created in the parent block //registering…
niklas
  • 2,887
  • 3
  • 38
  • 70
3
votes
3 answers

Add Bootstrap button styles to default Gutenberg Button block in WordPress

I want to use the default button styles from the Bootstrap framework with the default button block of Gutenberg. I found a solution to remove the default styles from WordPress and add some own styles. Here's the link:…
3
votes
1 answer

Is it possible to use draggable items in Wordpress Gutenberg Editor?

I have a problem with draggable items inside Gutenberg Editor in custom blocks. Is it possible at all? I tried to use draggable prop and Draggable component. Nothing works. Draggable attribute:
or
3
votes
2 answers

Get woocommerce product category using Gutenberg getEntityRecords

Is it possible to get all product categories using Gutenberg getEntityRecords()? I have found a code for getting post category as follows var query = {per_page: 100} categoriesList = getEntityRecords( 'taxonomy', 'category', query ); Can I alter…
3
votes
2 answers

Gutenberg update ParentBlock when innerBlock changes

I have created a gutenberg Slider-Block and a child block called slide. I want to update the slider everytime when a slide gets updated. I use the componentDidUpdate() from the innerBlock (the slide) but I don't know how to access the parent from…
Mathis Hüttl
  • 93
  • 2
  • 11
3
votes
0 answers

WordPress Gutenberg: dynamic block doesn't load the list of posts

In the tutorial "Creating dynamic blocks" it is explained that to load the list of recent posts in a Gutenberg block the code to use is this: var el = wp.element.createElement, registerBlockType = wp.blocks.registerBlockType, withSelect =…
Aerendir
  • 6,152
  • 9
  • 55
  • 108
3
votes
1 answer

Edit srcset and sizes attributes in Gutenberg image, cover and gallery - blocks

I am looking for a way to adress the responsive srcset and sizes attributes on Gutenberg image blocks - like image, cover and gallery. Usually one would do this with the 'wp_get_attachment_image_attributes' filter, like: function new_img_sizes(…
3
votes
1 answer

Gutenberg Custom Block: Add elements by innerBlocks length

Context: I'm working on a Custom Gutenberg plugin. One of the blocks I'm trying to create is a Carousel (using Bootstrap's Carousel). I'm trying to optional add indicators based on the number of child blocks. I'm getting the error: Block validation:…
Ricardo
  • 106
  • 1
  • 8
3
votes
1 answer

Gutenberg: Allow additional formatting in RichText

I have created a fairly simple accordion block, and it works great for basic text. The problem is that the control I am using for the accordion content is the RichText, which only allows for basic formatting such as bold. What if I wanted to create…
Harmonic
  • 367
  • 1
  • 3
  • 18
3
votes
1 answer

Gutenberg media upload in Inspect Controls

I am trying to upload the file via Media Library from Inspect Control in Gutenberg. I am using this code currently in JS : var el = wp.element.createElement, registerBlockType = wp.blocks.registerBlockType, ServerSideRender =…
daniyalahmad
  • 3,513
  • 8
  • 29
  • 52
3
votes
2 answers

How to add a custom block to WordPress Gutenberg blocks?

I want to create a new custom block for Gutenberg, is it possible?
Javad
  • 178
  • 2
  • 14
3
votes
1 answer

Add fields in advanced block setting

Trying to build a custom block with settings in Advanced block settings tab which opens in the sidebar on RHS... WordPress' default blocks seem to have settings there but unfortunately can't find it documented anywhere... Any pointers would be…
shramee
  • 5,030
  • 1
  • 22
  • 46
2
votes
1 answer

How to get image URL and metrics by ID from Gutenberg frontend

How can I query the URL, height, width and alt text of an image by its media id using JavaScript? There's a way to do so by using the PHP function wp_get_attachment_metadata. Is there a JavaScript function I can call in frontend to get the image…
2
votes
2 answers

Gutenberg block CSS does not apply to preview in template parts editor

I'm trying to add support for template parts to my WordPress theme. I have a block with a stylesheet and a script and everything works fine. However, in the template part editor (Design -> Template parts), my styles are loaded but they don't apply…