Skip to content

Instantly share code, notes, and snippets.

View gist:5173811
<?php
// Can be called whenever.
function add_admin_notice( $code, $message, $type = 'error' ) {
global $wp_admin_notices;
if ( ! isset( $wp_admin_notices ) )
$wp_admin_notices = array();
$wp_admin_notices[] = array(
View fetchGiphy.js
var fetchGifs = _.debounce( function fetchGifs( search ) {
if ( attributes.fetching ) {
return;
}
props.setAttributes( {
fetching: true,
} );
$.getJSON( 'https://api.giphy.com/v1/gifs/search?api_key=Fswo3IBHt0TViFMN6zYgbYzSEb3sLx7I&limit=10&offset=0&rating=G&lang=en&q=' + encodeURI( search ) )
View demo.diff
diff --git a/packages/block-editor/src/components/block-styles/index.js b/packages/block-editor/src/components/block-styles/index.js
index 2485c73e9..ad77a6965 100644
--- a/packages/block-editor/src/components/block-styles/index.js
+++ b/packages/block-editor/src/components/block-styles/index.js
@@ -72,6 +72,7 @@ function BlockStyles( {
block,
onSwitch = noop,
onHoverClassName = noop,
+ allBlocks,
} ) {
View podcast-playlist.php
<?php
function render_block( $attributes ) {
do_shortcode( '[playlist type="podcast"]');
}
function podcast_playlist( $output, $attributes, $instance ) {
if ( 'podcast' !== $attributes['type'] ) {
return $output;
}