This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var recursivelyRecoverInvalidBlockList = blocks => { | |
| const _blocks = [ ...blocks ] | |
| let recoveryCalled = false | |
| const recursivelyRecoverBlocks = willRecoverBlocks => { | |
| willRecoverBlocks.forEach( _block => { | |
| if ( isInvalid( _block ) ) { | |
| recoveryCalled = true | |
| const newBlock = recoverBlock( _block ) | |
| for ( const key in newBlock ) { | |
| _block[ key ] = newBlock[ key ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE `temp` like `mytable`; | |
| INSERT `temp` SELECT DISTINCT * FROM `mytable`; | |
| DROP TABLE `mytable`; | |
| ALTER TABLE `temp` RENAME `mytable`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { registerPlugin } from '@wordpress/plugins' | |
| import { useEffect } from '@wordpress/element' | |
| const doSomething = () => { | |
| useEffect( () => { | |
| // Do whatever when the block editor is initialized. | |
| }, [] ) | |
| return null | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import domReady from '@wordpress/dom-ready' | |
| domReady( () => { | |
| if ( window._wpLoadBlockEditor ) { | |
| window._wpLoadBlockEditor.then( function() { | |
| // Do whatever when the block editor is initialized. | |
| } ) | |
| } | |
| } ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'wp_head', function () { ?> | |
| <script> | |
| window.addEventListener( 'scroll', function() { | |
| const limit = document.body.classList.contains( 'home' ) ? 300 : 50 | |
| if ( ( window.pageYOffset || document.body.scrollTop ) > limit ) { | |
| if ( ! document.body.classList.contains( 'is-scrolling' ) ) { | |
| document.body.classList.add( 'is-scrolling' ) | |
| } | |
| } else { | |
| if ( document.body.classList.contains( 'is-scrolling' ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); | |
| function my_theme_enqueue_styles() { | |
| wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); | |
| wp_enqueue_style( 'child-style', | |
| get_stylesheet_directory_uri() . '/style.css', | |
| array( 'parent-style' ), | |
| wp_get_theme()->get( 'Version' ) | |
| ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Disable blog post image size generation in Stackable. | |
| remove_action( 'after_setup_theme', 'stackable_blog_posts_image_sizes' ); | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .ugb-image-upload-has-placeholder[data-is-placeholder-visible="true"] { | |
| display: flex !important; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setTimeout( function() { | |
| var ttes = document.querySelectorAll( '.tte_wrapper' ); | |
| Array.prototype.forEach.call( ttes, function( el ) { | |
| var typeAttr = el.getAttribute( 'data-effect' ); | |
| // Make the element visible and remove original text. | |
| // Original text is for SEO. | |
| var mid = el.querySelector( '.tte_mid' ); | |
| mid.innerHTML = ''; | |
| mid.style.opacity = ''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get the data of a block | |
| wp.data.select( 'core/block-editor' ).getBlocks()[0] | |
| // Update attributes of another block | |
| // wp.data.dispatch( 'core/editor' ).updateBlockAttributes( clientID, attributes ) | |
| wp.data.dispatch( 'core/block-editor' ).updateBlockAttributes( '10d88a6d-95d6-4e07-8293-5f59c83a26c0', { heading: 'New Heading' } ) | |
| // Get currently selected block. | |
| wp.data.select( 'core/block-editor' ).getBlockSelectionStart() |
NewerOlder