Embed dynamic media query in a Gutenberg block

If we stick to your exact example, I would define the value as a custom property in an inline style: <div class=”item” style=”–my-gap: <?php echo esc_attr( $attributes[‘gap’] ); ?>;”> Then in CSS use a media query to use the property as the appropriate margin: .item { margin-bottom: var(–my-gap); } @media ( min-width: 768px ) { … Read more

How to use Javascript to get data from a WordPress form

This approach should work, Modify it for your use case. //JQuery Code jQuery( document ).on( ‘change’, ‘.from-this’, function( e ) { e.preventDefault(); jQuery( ‘.change-this’ ).text( this.value ); } ) HTML Code: <input type=”search” class=”from-this” /> <div class=”change-this”></div>

Add custom data attribute to every core Gutenberg Blocks

I found the solution: I removed addFilter(‘blocks.getSaveContent.extraProps’, ‘luxuryconcept/add-custom-props’, addCustomProps); as @TomJNowell recomended. I added the add_filter(‘render_block’, ‘theme_custom_add_custom_attributes’, 10, 2); PHP code to functions.php: So, here all the working code: JS: /** * * Extends Core Gutenberg Blocks functionalities * * @description Add data-delay and data-duration attributes to every Gutenberg Core Blocks * @package luxuryconcept * … Read more

Is It Possible to Use the Block Editor’s Notification Feature to Send Another Notification After the Post Is Saved?

Yes, but you have to do it Redux- way. Subscribe to post saving action (there are separate actions for save and auto-save) and dispatch a message using dispatch function. Edit: Inside blocks, there are better hooks to use, like useSelect. But, outside the block, in general block editor environmentm you have to use subscribe. In … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)