New answers tagged

0 votes

How reorder post tags taxonomy in the non-alphabetical custom order and save it in the Block Editor

To reorder post tags taxonomy in a non-alphabetical custom order and save it in the Block Editor To achieve results use a combination of custom code. // Custom function to fetch tags in custom order ...
vijay pancholi's user avatar
2 votes
Accepted

Can you nest columns/column in a gutenberg custom template?

I believe the cause of the problem has nothing to do with columns and nesting columns within columns,. The errors are related to the very first block added in the template and a mixup of the syntax ...
Tom J Nowell's user avatar
  • 58.9k
2 votes
Accepted

How do I load css in edit screens for the block builder?

To load a custom stylesheet for the WordPress admin screens that manage posts and use the block editor, you can use the admin_enqueue_scripts hook to enqueue your stylesheet. Here's an example of how ...
Jahid Shah's user avatar
3 votes
Accepted

Star Rating block is not present from list of blocks or from / shortcut

You mentioned that you're on GoDaddy, but you linked to a WordPress.com support article. WordPress.com is a hosting service that you would not be using if you are in fact using GoDaddy. Note that ...
Jacob Peattie's user avatar
0 votes

How to remove class="wp-block-heading" from Heading tags?

You can use this code instead: function gauravt_remove_wp_block_heading_class_from_headings($content) { // Use regular expression to find and remove the class="wp-block-heading" from h1 ...
Gaurav Tiwari's user avatar
0 votes

Innerblocks isn't adding new blocks when template changes

Blocks won't be created or removed unless the template is locked. To lock the template add this argument to the InnerBlocks wp.element.createElement(wp.blockEditor.InnerBlocks, {template: ...
Coomie's user avatar
  • 141
0 votes
Accepted

Unable to edit custom post type, editor crashes. What to do?

After I completed the migration from custom field to custom taxonomy, and removed the custom field, I was able to edit the custom post types again. So, it appears that you can not have a custom field ...
MastaBaba's user avatar
  • 257
0 votes

How to set the background color of a template part (Header/Footer) in Twenty Twentythree?

To set the Bg color of the header or footer using theme.json, you need to define a custom style property for the respective template part. theme.json { "version": 1, "settings&...
vijay pancholi's user avatar
1 vote

Disable block from the editor if another block is used inside current post

You may have a Wood block that describes the type of wood used in a woodturning item, or a Minerals block to list the minerals used for a jewelry work. You don't want this two blocks to be used at the ...
Tom J Nowell's user avatar
  • 58.9k
0 votes

Possible to use @wordpress/create-block with multiple blocks?

I set up a new plugin using @wordpress/create-blocks. I just split up the files that create-blocks scaffolds out, but used the same build scripts, node_modules, etc. As far as I could tell, there's no ...
Scribblemacher's user avatar
0 votes
Accepted

Attributes array not saving values

The best way to achieve what i was wanting to do was to use the core blocks for latest post. Then style as I needed to. Here is what my code looks like. import { registerBlockType } from "@...
Dave B's user avatar
  • 25
1 vote

Possible to use a block filter (blocks.getSaveContent.extraProps) with dynamic blocks?

I had the same problem, and stumbled upon this in-depth answer in the closed issue on the Gutenberg repo: https://github.com/WordPress/gutenberg/issues/36127#issuecomment-1106645202 I ended up adding ...
beat's user avatar
  • 31
1 vote
Accepted

How to add an additional dependency to a block index.asset.php file

Actually, you do not need to worry about adding the Masonry's script handle to the dependencies array in the asset file (index.asset.php). All you needed to do to make your Masonry code work properly ...
Sally CJ's user avatar
  • 38.9k
2 votes
Accepted

How to get and set post meta for core/navigation-link?

If it's a menu item in a classic menu, then yes, you could use useEntityProp to get and set the menu item's post meta, except that the post type is actually nav_menu_item and that you would need to ...
Sally CJ's user avatar
  • 38.9k
1 vote
Accepted

Is there a standard "Archive" block that shows ALL posts from a specified category?

All the items under your "What I want" list can be easily achieved using the Posts List block which is a variation of the Query Loop block, and if you want to, you can create your very own ...
Sally CJ's user avatar
  • 38.9k
0 votes

Replacing specific Gutenberg blocks

I am not sure If I get what you meant, but study https://developer.wordpress.org/reference/hooks/render_block_this-name/ filter, whan calling it give it $accepted_args number of 3 and inspect what is ...
Lovor's user avatar
  • 901
0 votes
Accepted

move useState variable from edit.js to save.js. How do I do that?

I want to move the useState variable selectedValue once it's defined in edit.js and import it into save.js. In edit. js the code looks like this This is impossible and not how save components work. A ...
Tom J Nowell's user avatar
  • 58.9k
1 vote

Getting index of a custom ACF block with PHP?

For those looking for a PHP solution. A good place to do this is in the render_callback function. One thing to keep in mind with this solution is that this only works on first load, which is good ...
Mike Postma's user avatar
0 votes

Changing block quote size in gutenberg

just add blockquote to div <div class="blo"> <blockquote> your text (no need to add <p> tag) </blockquote> </div> CSS file: .blo blockquote{ font-...
Mohamed Omar's user avatar
1 vote

How to list all registered blocks

The Basics I realize this is older, but recently had to do exactly the same thing (whitelist certain blocks). Your code does work, but you have to be sure it runs after all blocks are registered. ...
mindfullsilence's user avatar
2 votes
Accepted

How to use get_option() in Gutenberg block editor to retrieve global settings?

If your option is enabled in the REST API, e.g. by using register_setting() with 'show_in_rest' => true, you can use wp.data.select( 'core' ).getSite() to retrieve the value of your option, and to ...
Sally CJ's user avatar
  • 38.9k
0 votes

Override categories with Pages (block theme)

You can modify your WordPress behavior to display a page instead of showing the category archive. However, the function you've provided wpb_redirect_category_to_page uses a redirection approach, which ...
WordPress Buddha's user avatar

Top 50 recent answers are included