Questions tagged [block-editor]

The Block Editor is the 'new publishing experience' slated for introduction in WordPress 5.0, replacing TinyMCE and other aspects of the default editing experience. Find out more at https://wordpress.org/gutenberg/

Filter by
Sorted by
Tagged with
1 vote
0 answers
35 views

How to check if a WordPress core block is active in sidebar

I have a widget area and I want to enqueue a stylesheet only if a core block is active in it. I tried the following code: // if has audio block. if (has_block('audio')) { wp_enqueue_style('audio-...
user avatar
2 votes
1 answer
30 views

What is the significance of 'root' in getEntityRecords?

I've gone through the documentation and the source code but I couldn't understand. I have 2 queries: getEntityRecords( 'postType', 'post' ); and getEntityRecords( 'root', 'user' ). Why does the 2nd ...
user avatar
0 votes
0 answers
19 views

Two text color palettes are appearing in Gutenberg

In a custom theme, I have establish custom colors for my client. However, two different text color options are appearing in the editor. The only way to describe it is with the attached image. ...
user avatar
1 vote
1 answer
60 views

Show date post published in Gutenberg component

I am coming from the PHP world where I would just put <div> <h1><?= get_the_title() ?></h1> <p><?= the_time('j F Y'); ?></p> </div> Now I have a ...
user avatar
  • 244
0 votes
0 answers
27 views

WordPress How to reorder Page/Post Settings

I am trying to move Yoast Seo to the bottom of my Post/Page settings sidebar. I am not sure how to hook into those so I can change the order. Order I need Status & Visibility Permalinks ...
user avatar
0 votes
0 answers
11 views

Wordpress latest core update conflicting with newspack-newsletter plugin

In my website using Gutenberg with newspack-blocks plugins for online magazines. everything was working fine. Yesterday I have updated latest wordpress 5.9.1, afterthat I am getting the issues with ...
user avatar
  • 101
1 vote
0 answers
19 views

Double container elements on custom block in editor

The custom block I have created gets duplicate container elements in the editor. And the custom classes I set only gets applied to the inner container. On the front end the block output is as expected....
user avatar
0 votes
0 answers
18 views

var(--text-color) in style.scss works once but not twitch

I just want the ender user to be able to change the link hover color but for some reason, it only works with one var in style.scss but it works fine in editor.scss. This is a plugin NOT A THEME Can ...
user avatar
1 vote
2 answers
188 views

Does `viewScript` in `block.json` actually enqueue a js file?

If I have declared, viewScript in my block.json file. Do I need to enqueue the script manually within my register_block_type(); function also? (I didn't think it was necessary for 5.9?) My Block.json &...
user avatar
  • 137
0 votes
2 answers
52 views

CheckboxControl does not visible change

I use the following code to add a custom option in the Gutenberg-sidebar. Its visible and saving the Checkbox-value works. But: if I click on the CheckboxControl nothing visible changes on it. If it ...
user avatar
0 votes
1 answer
33 views

How can I import one custom block into another?

I've been writing various custom blocks, but have run into a small issue: I'd like to be able to directly reference a custom child block inside a custom parent block. The problem is I already have an ...
user avatar
  • 206
1 vote
1 answer
71 views

While creating Block Themes in Wordpress, how can I query custom posts for an Archive view?

I am new to wordpress .. so please be kind..:-).. I was excited that WP could be used without knowing a lot of PHP. So I've gone ahead and created a block design and created a theme.. and it seems to ...
user avatar
1 vote
0 answers
17 views

How to Disable auto id attributes in Heading tag?

I don’t know why but WP is automatically adding id attributes to h2 tags. I am not supplying any id or class attribute and I don’t need it. Also, it’s adding type="1" to <ol> tag that’...
user avatar
0 votes
0 answers
26 views

How to disable a WP Image Block to link to itself?

When I insert an image through Gutenberg. The default behavior will make the image clickable. When you click on the image, it will open the link to the image. I don't want the images to be clickable, ...
user avatar
  • 999
0 votes
0 answers
32 views

Problem with pagination block in Gutenberg

I’ve built a site using Gutenberg (I wanted to avoid any other page builders) but I needed custom blog page so I created it too – and there is the problem. So basically I have multiple tabs with ...
user avatar
0 votes
0 answers
20 views

Is it possibe to prepend `<TextControls>` with icons or text?

The Block Editor Handbook - (TextControl) makes no reference to being able to prepend an input with an icon or text. ACF does offer this functionality as shown in the image below. Does this ...
user avatar
  • 137
0 votes
0 answers
28 views

Unwanted white space next to inputs added within `PluginDocumentSettingPanel` using `<PanelRow>`

So I've encountered something I'm not quite sure of, so I thought I'd ask and see if anyone else has had a similar problem. I've created a new PluginDocumentSettingPanel Instance to include my custom ...
user avatar
  • 137
0 votes
0 answers
10 views

How to Analyze Blocks and find Intersection and patterns between pages

What is the best way to analyze existing site fully built on Gutenberg Blocks and inspect intersection of existing blocks structure and it’s inner blocks combination for all pages? Context: Imagine ...
user avatar
1 vote
1 answer
43 views

How to allow to add gradients to core/heading block?

is there a way to add gradients support for background in the core/heading block? I've tried to extend settings.supports with gradients: true add gradients to theme json: "blocks": { ...
user avatar
0 votes
0 answers
46 views

Wordpress Gutenberg - Sidebar get posts list based on selected category

I need to display the complete posts list in the dropdown list in the custom block sidebar. I used for that withSelect: ... const currentPostId = select('core/editor').getCurrentPostId(); ...
user avatar
  • 151
2 votes
0 answers
49 views

How do you override Post template when using Query Loop block?

Seems like an impossible task to override how posts are rendered in Query Loop block (grid). Default block level controls enables styling but not overriding of markup. I just want to apply HTML5 ...
user avatar
1 vote
1 answer
47 views

How to transform block variant to default version?

I have a simple block variation: wp.blocks.registerBlockVariation( 'core/heading', { name: 'headline', title: __('Big title'), attributes: { className: 'headline' ...
user avatar
3 votes
1 answer
115 views

WordPress: After Gutenberg plugin migration to block.json the localization/ translations with PolyGlot in JavaScript does not work anymore

I made a plugin with existing localization on WordPress.org for free. I migrated to block.json and made all changes by comparing it to the output of npx @wordpress/create-block todo-list. I read ...
user avatar
  • 579
0 votes
0 answers
47 views

How to change how WordPress renders navigation menu on Block Themes

With classic templates it was easy to understand how to overwrite how Wordpress navigation menu was rendered, but I'm struggling with the new Theme blocks approach. I know it uses the navigation block ...
user avatar
  • 101
1 vote
0 answers
31 views

How can I add a color picker to a custom Gutenberg block which includes the default system palette from theme.json?

Do I need to use the ColorGradientControl component to add this interface to a custom block, even if gradients are deactivated by theme.json?
user avatar
1 vote
1 answer
110 views

Enqueue styles in new site editor in WordPress 5.9

In the block editor for posts and pages, I used to use the enqueue_block_editor_assets hook to enqueue styles for the block. add_action( 'enqueue_block_editor_assets','load_assets_in_block' ); ...
user avatar
3 votes
1 answer
231 views

Adding a custom PanelColorSettings control to a core block, and using the color slug in a custom className

I'm trying to add a custom color control to the group and cover blocks, and if a color is selected, construct a custom className for the block. This custom class is used for a section separator. What ...
user avatar
2 votes
0 answers
42 views

Provide specific example for block variation

I'm generating block variations on top of the "native" Gutenberg blocks (eg. core/***). For example, I have a "catchphrase" block, which is a variation of the paragraph block (core/...
user avatar
  • 121
0 votes
0 answers
25 views

Default paragraph block styles just for pages NOT for posts?

With the help of the great article from Erikson I am adding a new default block style to a paragraph on all pages, like this: function be_gutenberg_scripts() { global $pagenow; if (( $pagenow =...
user avatar
  • 13
2 votes
1 answer
201 views

How do I listen for a change in an innerBlock child?

I've created a custom block that uses a WordPress core block as an innerBlock child; more specifically the core/embed block. What I'd like to do is listen for changes in the child block's attributes, ...
user avatar
  • 206
0 votes
1 answer
29 views

How to update mark-up of a gallery block in a custom theme?

I’m developing a custom WordPress theme and it’s my first time working with WordPress in a little while. I can see the post and page editor has been completely overhauled, and posts and pages can be ...
user avatar
1 vote
0 answers
23 views

How can I center Gutenberg buttons on mobile?

I have created 3 buttons in a row with Gutenberg. On Desktop I have them all in the same row. I can get that to look okay. The problem is that on mobile it doesn't center the buttons (they all float ...
user avatar
  • 340
0 votes
2 answers
30 views

Can I use WP blocks in a template?

I'm not exactly sure how to explain this, but I have a slider I built using ACF that I placed on my home page. After this code, I want to use a WP block I built, and after that I want to put another ...
user avatar
  • 3
0 votes
0 answers
16 views

Toggle between block 'edit content' and 'select' not properly working in WordPress Admin

I've been struggeling for a while now with toggeling between 'marking / selecting a certain block' and 'editing content' of that block in WordPress' Admin area. When I click on a specific block in a ...
user avatar
  • 353
0 votes
1 answer
45 views

Align a custom block button by wrapping it in div

I made my custom block button. I want wrap it in and align a button horizontally. How could you wrap it? Below code has two problems It doesn't allow to edit a text in a button It doesn't allow a ...
user avatar
0 votes
1 answer
113 views

Editable button with RichText for Gutenberg custom block

I'm making an editable button for gutenberg editor. I wrote below code, but it doesn't allow me to edit a text in a button. Does anybody know what's wrong? Thank you in advance. themedir/custom-block/...
user avatar
0 votes
1 answer
94 views

Gutenberg and FSE: How to exclude a block from full site editing

One of my blocks only works in posts. It does not make sense to use it on the homepage. Another thing my block does not support is multiple instances on the same post id. I could prevent that with: &...
user avatar
  • 579
0 votes
0 answers
16 views

When setting styles to an extended block that was saved as a pattern, it doesn't remove the style that was there

I'm extending the button block, adding extra options such adding theme colors (a color picker) and icons (radio group). This adds class names for each of the options. has-icon, has-icon-{icon}, is-...
user avatar
0 votes
1 answer
21 views

Why is an argument of onChange nested in <p>...</p> in Gutenberg custom block RichText?

When editing a RichText on an admin panel, onChange's argument is nested in a paragraph tag like <p>my input</p>. However, I have not specified p tag anywhere in my source code. Even when ...
user avatar
1 vote
1 answer
194 views

Register JS for block on frontend only

I'm using the following in PHP to register my custom block: register_block_type( __DIR__, /* block.json */ array( 'render_callback' => 'render_my_block', 'script' => 'my-custom-js', )...
user avatar
  • 261
0 votes
2 answers
64 views

Gutenberg: Prevent links from being clickable in the block. Error: "Cannot destructure property 'frameElement' of 'r' as it is null."

I added my block to an article and the new full site editing. The block renders an tag. When I select the block in the editor I click on the tag and I get a "Cannot destructure property '...
user avatar
  • 579
0 votes
1 answer
62 views

Looping over wordpress meta to create `<TextControl>` 's?

I'm looking for an intelligent way to iterate over available post meta, preferably by using the prefix _postcode_pricing_, and create new <TextControl> components for each. Really, I have two ...
user avatar
  • 137
1 vote
1 answer
42 views

Editor API Endpoint or Data Store That Provides a List of Meta Fields for Post Types

I'm building a custom block that allows an editor to choose a Meta Key from a dropdown menu: However, I am unable to find a data store or API endpoint available (out of the box) that will provide a ...
user avatar
0 votes
0 answers
49 views

wordpress full site editing problem when extending core blocks

Hi i am extending the heading block using the filter hooks functions. so i am using the "blocks.registerBlockType" to add additional attributes. i am using the "editor.BlockEdit" ...
user avatar
  • 113
0 votes
1 answer
170 views

WordPress npm run build and start only outputs wp-scripts start but does nothing

I made a WordPress plugin with 3 blocks. The package.json looks like this: "scripts": { "build": "wp-scripts build", "format": "wp-scripts ...
user avatar
  • 579
0 votes
1 answer
80 views

Gutenberg getBlockIndex in save() function

In my block's edit() function i'm getting the index of each inner block: // a block used in innerblocks edit( { attributes, setAttributes, clientId } ) { let blockIndex = wp.data.select( 'core/...
user avatar
  • 261
0 votes
1 answer
99 views

Why does the custom HTML block not preserve the HTML characters?

For example it seems that the plain single-quote character ' (&#x27;) is converted to the right ones ’ (&#8217;) in the HTML page output. I understand the reason for this in regular Gutenberg ...
user avatar
  • 308
0 votes
1 answer
75 views

Gutenberg Blocks - Cannot retrieve block saved attributes in edit post

After registering a new block in Gutenberg editor, it works fine until save /publish post, the output is fine in front end too, but after refreshing the edit screen, block shows the block validation ...
user avatar
  • 152
1 vote
0 answers
259 views

Print custom field in Query Loop block

I have added a custom field with the Advanced Custom Fields plugin. I can print the content of the field on the post itself using the acf shortcode ([acf field="date"]) without issues. ...
user avatar
0 votes
1 answer
171 views

Gutenberg Blocks: how to determine an index of the current inner block?

I'm trying to implement a bootstrap5 carousel component as a Gutenberg block. It all appears to be working as intended, except for adding the "active" class to a first element. I tried to ...
user avatar

1 2
3
4 5
29