Unanswered Questions
761 questions with no answers
6
votes
0
answers
521
views
Gutenberg Blocks doesn't render correctly when using do_blocks
I'm trying to render a post_content with blocks using the do_blocks function, that takes a gutenberg content, parses every block, and returns an HTML string.
The problem is that some blocks aren't ...
5
votes
0
answers
883
views
Is there a core Sortable component in Gutenberg?
I managed to somewhat replicate the product gallery metabox from WooCommerce in Gutenberg using the
third-party react-sortable-hoc component. As it seems that this component is no longer supported, I'...
5
votes
0
answers
1k
views
Remove left alignment option in core/image block
I’m trying this code to disable the left alignment option from the core/image block. I just want to make available the center and right alignment options.
wp.hooks.addFilter(
'blocks....
4
votes
0
answers
1k
views
Developing the save function in Gutenberg blocks
I am editing the save function on my local wordpress instance. Every time I make a change, I need to manually click the "Attempt Block Recovery" button to see the updated change when I go to ...
4
votes
0
answers
536
views
Custom Block - save.js function not saving attributes
I'm trying to get just a basic custom block displaying in the editor and saving. I've followed multiple tutorials and I keep getting the same result. No matter how simple my block is, whenever I add a ...
4
votes
0
answers
321
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/...
4
votes
0
answers
205
views
Hooking a callback into the code within a Gutenberg block
I want to run some JavaScript when a user uploads an image or images using the core/image block or core/gallery block. Ideally I would run my own code when the onSelectImage function is called (and ...
3
votes
0
answers
82
views
Can I customize any WordPress parent block-based theme template files by child theme like a parent classic theme?
Usually, I can replace the template files and PHP codes of any parent classic theme with child themes. Since block-based theme templates rely on HTML, how can I replace parent block-based theme files ...
3
votes
0
answers
110
views
What is "open()" in MediaUpload?
Googling (or searching here) on "open" is hard :)
The readme for MediaUpload gives this example:
<MediaUpload
onSelect={ ( media ) => console.log( 'selected ' + ...
3
votes
0
answers
2k
views
Changing order title and featured image in blog post (Astra theme)
The HTML of a post type, I want to swap the position of the title and the thumbnail. I noticed that the title and thumbnail are inside a <header> tag. So I went looking which template file has ...
3
votes
0
answers
650
views
WASM page in Wordpress website
I used emscripten to generate some html/js/wasm/data files and would like to add that as a page to my (Wordpress) website. Is this possible? If so, how?
3
votes
0
answers
55
views
WordPress Rest API only returns content when posttype has editor capability
I am trying to request my post via the WordPress V2 Rest API in the backend. For whatever reason the post content is only returned when my custom post type has the editor support enabled. Is there a ...
3
votes
0
answers
386
views
WordPress Customizer Control with React
I am just doing a demo on the WordPress customizer API to edit the header with custom controls.
I have designed a custom control by extending WP_Customize_Control and Jquery to refresh/postMessage ...
3
votes
0
answers
118
views
How can I filter block registration based on post-type? (Block alignment settings)
I want to disable the .alignwide and .alignfull block alignment options (remove them from the editor UI) on the 'post' post-type only.
I have tried using this block registration filter to modify the '...
3
votes
0
answers
246
views
How to save a ToggleControl value in a meta field?
I registered a boolean meta field called _meta_restrict in a custom post type:
PHP:
function register_meta_fields() {
register_post_meta( 'custom_post_type', '_meta_restrict', array(
'...