block theme FSE – save changes to the theme?

I’ve done a lot of digging into the subject and looks like they were working on some updates to Gutenberg that would allow them to be saved onto the filesystem: youtu.be/8Vj_Oh6jMHw?t=281. But those efforts were later abandoned: github.com/WordPress/gutenberg/pull/40385, as adding that support into WordPress core was complicated. I then found this plugin that lets one … Read more

Custom plugin not appearing

A few parameters need tweaking in midstory_fade_animation_script_register(): function midstory_fade_animation_script_register() { // Handle, script location, dependecies, version, in footer boolean wp_enqueue_script( ‘midstory-animation-fade-block’, plugin_dir_url( __FILE__ ) . ‘/midstory_animation_fade.js’, array( ‘wp-blocks’, ‘wp-i18n’, ‘wp-editor’ ), ‘1.0.1’, false ); } The script location needs a slash between the plugin folder and the filename. What you were calling “WordPress refresh?” is … Read more

How to disable blocks in Gutenberg editor for specific post type

Put this in your Theme’s functions.php file. add_filter( ‘allowed_block_types_all’, ‘rt_allowed_block_types’, 25, 2 ); function rt_allowed_block_types( $allowed_blocks, $editor_context ) { if( ‘custom_post_type’ === $editor_context->post->post_type ) { $allowed_blocks = array( ‘core/image’, ‘core/paragraph’, ‘core/heading’, ‘core/list’ ); return $allowed_blocks; } else { return; } } Here’s what it’s doing. The filter allowed_block_types_all is filtering what block types are allowed. … Read more

Have parent block’s isSelected be true if an innerblock is selected?

If you only need to know whether or not an inner-block is selected, you can leverage the core/block-editor store’s hasSelectedInnerBlock() selector. For example, if using a useSelect() hook in a functional component, that might look as such: import { useSelect } from ‘@wordpress/data’; export default function Edit( { isSelected, clientId } ) { const is_inner_block_selected … Read more

FormTokenField passing objects to value property

In short, the “title” which the documentation refers to is a title attribute on the <span> which is rendered for the token, which is to say that the token { value: ‘29654’, title: ‘Post Title’ } will (rhetorically) render as <span title=”Post Title”>29654</span> In order to display “Post Title” as the inner text in the … Read more