Skip to content

Instantly share code, notes, and snippets.

View noisysocks's full-sized avatar

Robert Anderson noisysocks

View GitHub Profile
@noisysocks
noisysocks / gutenberg.diff
Created July 31, 2020 06:11
Render navigation block if theme requests it
diff --git a/lib/compat.php b/lib/compat.php
index 5941bbb1f2..c0e7150384 100644
--- a/lib/compat.php
+++ b/lib/compat.php
@@ -640,6 +640,69 @@ function gutenberg_output_html_nav_menu_item( $item_output, $item, $depth, $args
}
add_filter( 'walker_nav_menu_start_el', 'gutenberg_output_html_nav_menu_item', 10, 4 );
+function gutenberg_capture_menu_items( $menu_items, $args ) {
+ $args->menu_items = $menu_items;
@noisysocks
noisysocks / no-ul.html
Last active July 31, 2020 03:25
Navigation markup
<!-- wp:navigation -->
<nav class="wp-block-navigation">
<div role="list">
<!-- wp:link -->
<div class="wp-block-link" role="listitem">
<a href="/">Home</a>
<div class="wp-block-link__submenu" role="list">
<!-- wp:link -->
<div class="wp-block-link" role="listitem">
<a href="/contact-us">Contact Us</a>
@noisysocks
noisysocks / inner-blocks-validation.diff
Created August 28, 2019 06:47
Gutenberg: Patching isValidBlockContent to worth with innerBlocks
diff --git a/packages/block-library/src/navigation-menu-item/save.js b/packages/block-library/src/navigation-menu-item/save.js
index 536d2f286..86b334099 100644
--- a/packages/block-library/src/navigation-menu-item/save.js
+++ b/packages/block-library/src/navigation-menu-item/save.js
@@ -5,7 +5,7 @@ import {
InnerBlocks,
} from '@wordpress/block-editor';
-export default function save( { attributes/*, innerBlocks*/ } ) {
+export default function save( { attributes, innerBlocks } ) {
@noisysocks
noisysocks / block.js
Last active October 2, 2018 18:43
Plugin for testing Child Blocks
( function() {
const { registerBlockType } = wp.blocks;
const { createElement: el } = wp.element;
const { InnerBlocks } = wp.blocks;
registerBlockType( 'acme/product', {
title: 'Product',
icon: 'carrot',
category: 'common',
@noisysocks
noisysocks / look-away.sh
Created January 30, 2018 04:21
Reminder to rest your eyes every 20 minutes
#!/bin/bash
# A little script to remind you to look away from your screen every so often.
#
# To install:
# 1. Save this script somewhere
# 2. Make the script executable: chmod +x /path/to/the/script.sh
# 3. crontab -e
# 4. Add this entry: */20 9-17 * * * /path/to/the/script.sh
@noisysocks
noisysocks / emoji.txt
Created April 14, 2016 19:47
List of emoji and their descriptions
😀 GRINNING FACE
😁 GRINNING FACE WITH SMILING EYES
😂 FACE WITH TEARS OF JOY
😃 SMILING FACE WITH OPEN MOUTH
😄 SMILING FACE WITH OPEN MOUTH AND SMILING EYES
😅 SMILING FACE WITH OPEN MOUTH AND COLD SWEAT
😆 SMILING FACE WITH OPEN MOUTH AND TIGHTLY-CLOSED EYES
😉 WINKING FACE
😊 SMILING FACE WITH SMILING EYES
😋 FACE SAVOURING DELICIOUS FOOD