Questions tagged [wordpress-gutenberg]

0

votes
0

answer
5

Views

Gutenberg - Looking to inject block data into wp_head on save

I have created a code editor block where the user can insert CSS styles. Rather than having these save to the post_content and show up in the body, I would like for them to be injected into the head. I have done this in the past using PHP hooks but cant seem to figure out how to translate that to...
tbuz3
1

votes
1

answer
948

Views

Display list of custom post type in Wordpress Gutenberg custom block

I'm trying to enable users of my Wordpress plugin/theme, which uses a custom post type to handle products, to make a block that displays a summary of one of these custom posts. I'm trying to accomplish this by creating a custom block in my plugin, based on the official tutorial. On the Gutenberg bac...
oelna
0

votes
0

answer
10

Views

How do i define/change Gutenberg block width myself?

First time I have tried the Gutenberg editor. I'm also using the Genesis framework for the first time. Right now I made a block with the wide setting. I have a hard time understanding how I make more space between the picture and text. If I change the margin the picture just begins to decrease in si...
brandtiboy
1

votes
0

answer
250

Views

Gutenberg extend blocks add new class name

I'm trying to add an extra class name to all the blocks by extending them. Documentation: Extending Blocks I'm using blocks.BlockEdit to modify the edit component. I want to add a custom class name. So far I have this const withClass = createHigherOrderComponent( ( BlockListBlock ) => { return ( pr...
CyberJunkie
1

votes
0

answer
225

Views

Title is not showing on the front end - Gutenberg

I have this component 'PostTitle' that gets the page title and changes as you edit the main page title that works in the editor, but i can't get it to show on the front end? not sure what i am doing wrong. UPDATE I have added a function to update the 'title' attribute, but the problem is it only fir...
Jim-miraidev
1

votes
0

answer
175

Views

Gutenberg blocks - processing server data within a block

I have a block that renders titles of all existing posts in the . I retrieve it from the server using (that returns plain html). I want to be able to choose one of the titles (ideally save it in the postTitle attribute) and display it in the block. attributes: { postTitle: { type: 'string' } }, edi...
Michal Karbownik
1

votes
1

answer
1.1k

Views

How to wrap block elements in divs in WordPress Gutenberg plugin

I am writing to see if there is a more 'WordPress' way to wrap blocks created with Gutenberg in WordPress. My approach, thus far, has been to use the 'HTML block' to add an opening div, then I create the block and finally, I close the div with another HTML block. Is this an acceptable way to wrap b...
martinpsz
1

votes
0

answer
644

Views

Use ajax data in Gutenberg InspectorControls

I am create custom Gutenberg editor block to set YouTube video Id to atribute data-video='' UPDATE - Added working code to the below My function.php code // Include Css and js block files function designa_youtube_block() { // Scripts wp_register_script( 'youtube-block-script', // Handle. '/wp-conte...
1

votes
0

answer
34

Views

How can I validate meta-boxes inside my Gutenberg plugin

I am trying to run a validation routine on my WordPress plugin which I am developing with Gutenberg. My plugin is to store Book information having the following fields, which are meta-boxes. author, price, pub_year, about_book The meta-boxes and posts are saving fine, but I want to implement some va...
Subrata Sarkar
1

votes
0

answer
41

Views

< is being converted into < in wordpress

I am using syntax highlighter to show code preview. But all '
Abdus Sattar Bhuiyan
1

votes
0

answer
22

Views

Assign template to a post type via Javascript

I was reading the Gutenberg documentation and I came across this: https://wordpress.org/gutenberg/handbook/templates/#existing-post-types After a good amount of research, I found out that I can tap into the Post Object (https://wordpress.org/gutenberg/handbook/data/data-core-editor/#getcurrentpost),...
José Osório
1

votes
0

answer
314

Views

Gutenberg Block Validation Failed ( not expecting children )

I am developing a gutenberg Testimonials block, however when saving and trying to reload it gives me block validation failure, it seems to be expecting a block without children in the carousel-inner etc. Expected: PreviousNext Actual: sdfas sdf fsadfa asdfassdfadf fdsafas sdfasdfas PreviousNext...
Brad Larson
1

votes
0

answer
49

Views

Color Palette style not adding properly

For reasons I can't comprehend, The custom CSS color name is not properly adding in the html elements. For example - I have text-color-red palette for my custom block and it shows up perfectly. When I select the color the corresponding HTML element gets text-color-#F44336 CSS class added instead tex...
Ashiquzzaman Kiron
1

votes
0

answer
91

Views

Wordpress Gutenberg HTML block restrictions on Ajax requests

Are there any restrictions on issuing Ajax requests from a Gutenberg html block? I have an html/jquery script making an Ajax request following wordpress protocol on Ajax but my post request is rejected with a 400 post status.
Dimitris
1

votes
0

answer
367

Views

WP Gutenberg InnerBlocks not saving

I created a custom block type called with the wp-cli, it's working, but when I add innerBlocks to it, the innerBlocks display, but don't save or adhere to any other attributes other than template, templateLock and allowedBlocks are all ignored. Also when I define wp.editor.InnerBlocks as a variable,...
Noltedesign
1

votes
1

answer
62

Views

Gutenberg - get values from server side

Im search information about it ago several hours but I cannot find a solve. I have a plugin with a global functions called 'get_regions()': $all_regions = get_regions(); // array('region-1', 'region-2', 'region-3', 'region-4') Then I need put those values in a select in my block Gutenberg. I have th...
Alexander
1

votes
0

answer
117

Views

Wordpress 5.0 automatic link all images to media file

I had small problem after WP 5.0 released, I was using php snippet to out all the gallery images Linked to 'media file' automatically and two columns with medium size, but the function stopped working. any ideas how can i make it work again with WP 5.0 Gutenberg! Thanks in advance. here is the old...
Adham Mohamed
1

votes
1

answer
472

Views

Gutenberg Wordpress: Extending Core Block

I am trying to add a padding Inspector Control to all core block of the new Gutenberg Wordpress Editor. I have created the Control on the Editor and now I am trying to apply this style to the block element its self. But I keep getting This block contains unexpected or invalid content. Error on the...
Zack Arnett
1

votes
1

answer
720

Views

WordPress Gutenbarg: 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 htmlvalidation check but that doesn't help. Also, after...
Imtiaz Shamim
1

votes
0

answer
30

Views

Wordpress 5+ Automatic link all gallery images to media file

Please guys i really need your help, I'm stuck with that! Before WP 5 I was linked all gallery images to 'file' automatically by using this filter below. add_filter( 'shortcode_atts_gallery', function( $out ){ $out['link'] = 'file'; return $out; } ); But after WP 5 how can i make it to work again?...
Adham Mohamed
1

votes
0

answer
79

Views

WP Bakery Page Builder Role Manager doesn't save Disable Classic Editor

After the Wordpress 5.0.2 update I had to also update the WP Bakery editor. It has the option to disable the Guntenberg editor and also on the Roles Manager tab it has the option for disabling the Classic Editor. After playing around a bit I saw that once the Classic Editor is disabled by checking t...
idm
1

votes
1

answer
176

Views

How to edit markup/add classes to default WordPress blocks?

I have created a series of custom blocks for WordPress 5.0.0, and really enjoying the Gutenberg experience thus far. However, I'm struggling to find anything online that will allow me to alter the output of default blocks, such as the paragraph block? For example, the default output of a paragraph b...
dungey_140
1

votes
0

answer
99

Views

Select posts that have a specific term using withSelect in Gutenberg block

I'm trying to select posts -- or more specifically, a custom post type -- that belong to a specific term, and display them in my Gutenberg block's edit screen. I'm wanting to recreate what would be tax_query with WP_Query, but in Javascript. I'm able to select posts, but I'm unsure what parameters t...
Tim Gieseking
1

votes
0

answer
31

Views

Gutenberg breaks svg on save

It seems that Gutenberg breaks SVG output in a block, but only for multi-word SVG attributes and only on save. Editor preview works fine. I've encountered this on a more complex example, of course, but here is the simplest possible way to recreate: If you add SVG to your edit and save functions with...
Ivan Čurdinjaković
1

votes
0

answer
27

Views

Show error from save_post in Post Editing/Adding Wordpress 5.0

In that green success section, wordpress will show a red error if there is an error. Id like to hook into that from my save_post php action when there is an error with my own custom text. is that possible?
Joe
1

votes
0

answer
173

Views

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 = wp.data.withSelect; registerBlockType( 'my-plugin/latest-post...
Aerendir
1

votes
0

answer
55

Views

Solution to Excerpt Customisation with new Gutenberg Editor

I have made several customisations to the native Wordpress Excerpt metabox which no longer seem to work with the new Gutenberg editor and I can find no documentation online that guides me to a solution. Does anyone know how the following code snippets can be amended to work with the new Gutenberg Ed...
Robert Kam
1

votes
0

answer
43

Views

Using styled-components in Wordpress Gutenberg save function

I am trying to use styled-components and other react components on the save() function, but it is not working, the styled-component works just fine on the editor ( edit function ), here is my code for the block: const { __ } = wp.i18n; const { registerBlockType } = wp.blocks; import styled from '...
Douara Abderrahman
1

votes
1

answer
55

Views

Custom template page in Wordpress' new Gutenberg

I would like to create a custom front page in the new Wordpress Gutenberg editor. In older version of Wordpress I could attach a page to a custom template. I can't see that option in Gutenberg. Regards Frank
de albuquerque frank
1

votes
1

answer
65

Views

WPBakery Visual Composer not loading

Im using the latest Wordpress version. Since GUTENBERG the Visual Composer is not working. I installed Classic Editor plugin. But it brought nothing. Also the Theme Customizer is not loading. Here you will find the error messages from the Console: Theme: ColorMag
Jannis
1

votes
0

answer
53

Views

Gutenberg add rich text button to editor, button not appearing

I am following the tutorial here - https://wordpress.org/gutenberg/handbook/designers-developers/developers/tutorials/format-api/ Step 1 - register a new format, this works ok and I can see my new format type in the console Step 2 - I've added the code to my-custom-format.js to make the button appea...
Layla Terrier
1

votes
2

answer
34

Views

Add extensions in GutenBurg blocks

I want to add some extensions in inspectControl How can I add this. Please check the image for better understanding. Extensions Like this Here is a code which I'm using but this one is not working. Can you please check it out what the problem. I'm not finding any documentation about this. Please re...
Azeem Haider
1

votes
1

answer
14

Views

gutenberg core/columns attributes via function.php

Gutenberg - Grid layout & attributes After the images and the galleries I am trying to modify the grid output. I have to recover 'how many columns has the grid' but I can't open the array or point to the right attribute / value. //// Change WordPress gutenberg grid add_filter( 'render_block', 'Guten...
Alberto
1

votes
0

answer
17

Views

Disable “Code Editor” for roles, e.g. Authors

I was asked to disable the 'Code Editor' and the 'Edit as HTML' function in the WordPress Gutenberg editor. Unfortunately I am not able to find any solution on Google (thanks, Classic Editor posts...) or in the wp.org Developer Reference. My first attempt was to filter the Code Editor menu entry wit...
Marvin
1

votes
0

answer
31

Views

How can I render my posts with my custom WordPress Gutenberg block by category?

I have been trying to create a Gutenberg block that displays a list of categories as checkboxes on my WordPress edit pages, and then displays on the frontend page a list of posts that are linked to the selected categories. I have successfully added the checkboxes for the edit pages. When I choose th...
Joshua Waheed
0

votes
0

answer
5

Views

In a WordPress Gutenberg block how can I create a multiple checkboxes using a CheckboxControl in the InspectorControls

I'm trying to create a custom WordPress Gutenberg block with multiple checkboxes of taxonomy terms pulled via the Rest API. I'm able to do this with a SelectControl. With a SelectControl you can just set multiple to true. I don't believe the CheckboxControl has this option. I want to do this in the...
Steve Jones
0

votes
0

answer
4

Views

Extra Gutenberg editor

Does anyone have a solution on how to integrate/activate a second gutenberg editor within WordPress? For the moment the Gutenberg editor parses the_content(). What I would like to achieve is a header introduction text where the user can add its own blocks, apart from the default content.
Filip Van Reeth
1

votes
1

answer
330

Views

Adding Entire Gutenberg Editor in Standalone Plugin

In one of my plugins I'm currently developing (TargetPop), I've embedded the TinyMCE editor so that the user can create contents for their Pop-Up, complete with both the 'Visual' and 'Text' views, and the ability to add media, style/formatting options, etc. See screenshot below. My question is: How...
Jake Evans
1

votes
2

answer
214

Views

Gutenberg Templates: Core Block Attributes

The Gutenberg Handbook currently has a short entry for creating whole templates of blocks used e.g. for Custom Post Types or the like. https://wordpress.org/gutenberg/handbook/templates/ It seems to be missing a comprehensive overview of the core/-Blocks though. Especially the available attributes...
Playnary
1

votes
1

answer
385

Views

Wordpress Gutenberg autocomplete - saving attributes

I want to develop a custom block that will let the user pick some information from autocomplete. I manage to create the autocomplete component on edit function. A user can select an item but i don't know how to handle the attribute save. I'm trying to save the selected item as attribute package_nam...
Crerem

View additional questions