Brandon Payton
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: WP5.0 Table block in template/InnerblocksThat’s great to hear! Cheers!
Forum: Developing with WordPress
In reply to: WP5.0 Table block in template/InnerblocksHi @annekrarup,
I found this to be tricky as well. The attributes definition for the table block isn’t easy read at a glance from the source code because the attribute definitions are generated dynamically. In addition, even if we can read the attribute definitions at a glance, they only describe how the attributes should be obtained from the block data, not how attributes will look once we have them.
In case you’d still like to look at the table block’s attributes definition, you can do so by evaluating the following in the browser dev tools console. Documentation here.
wp.blocks.getBlockType( 'core/table' ).attributes
This is helpful but isn’t a direct answer to “What do a specific table block’s attributes look like?”
The good news is that we can create your ideal table block in the editor and look up that block’s attributes via the dev tools console. In the console,
wp.data.select( 'core/editor' )
returns an object with selector functions for querying editor state, and itsgetBlocks
selector lets us ask for all the blocks in a post. Documentation here.Given the above, this code finds the first table block in a post and looks at its attributes:
wp.data.select( 'core/editor' ).getBlocks().find( b => b.name === 'core/table' ).attributes
And this gives us formatted JSON of the table block’s attributes:
JSON.stringify( wp.data.select( 'core/editor' ).getBlocks().find( b => b.name === 'core/table' ).attributes, null, "\t" )
The result should be the table attributes you’re looking for (except for maybe the extra quotes added for the JSON format : ).
Does that help?
- This reply was modified 5 years, 11 months ago by Brandon Payton. Reason: correct typo
Forum: Fixing WordPress
In reply to: JSON ErrorHi @stefanogger, your experience sounds a lot like this bug which has been filed under the Gutenberg plugin:
https://github.com/WordPress/gutenberg/issues/12532Do you happen to know whether your web server is IIS?
Forum: Fixing WordPress
In reply to: Where are Slug Field and Screen Options in ver 5.0.1?Hi @eadwig!
I’m sorry you’re facing this issue. The interface is certainly very different. Hopefully, the following helps.
Editing a post slug:
Once you’ve saved a draft of your post, clicking in the title field should cause the post’s permalink to be shown above that field. If you see the permalink area, there should be an Edit button there to edit the post slug. In case it helps, here is a gif showing that in action:Changing screen options:
Screen options can be found by opening the “Show more tools and options” menu in the top right corner of the editor (the button’s icon is like a vertical ellipsis) and selecting the “Options” item. In case it helps, here is a gif showing those options being opened:Does that help?