Skip to content

Instantly share code, notes, and snippets.

View ndiego's full-sized avatar

Nick Diego ndiego

View GitHub Profile
@ndiego
ndiego / block-hooks-api-examples-2-4.json
Created March 25, 2024 12:24
Block Hooks API - Examples 2 and 4
{
"landingPage": "/wp-admin/site-editor.php",
"preferredVersions": {
"php": "8.0",
"wp": "nightly"
},
"features": {
"networking": true
},
"steps": [
@ndiego
ndiego / block-hooks-api-examples-1-3.json
Last active March 25, 2024 12:23
Block Hooks API - Examples 1 and 3
{
"landingPage": "/wp-admin/site-editor.php?postType=wp_template&postId=twentytwentyfour%2F%2Fsingle",
"preferredVersions": {
"php": "8.0",
"wp": "nightly"
},
"features": {
"networking": true
},
"steps": [
@ndiego
ndiego / playground-experiment.json
Last active March 22, 2024 16:53
Playground experiment
{
"landingPage": "/wp-admin/site-editor.php",
"preferredVersions": {
"php": "8.0",
"wp": "beta"
},
"features": {
"networking": true
},
"steps": [
@ndiego
ndiego / block-hooks-demo.php
Last active March 22, 2024 20:39
Block Hooks Demo
<?php
/**
* Plugin Name: Block Hooks Demo
* Description: Block Hooks API experiments.
* Version: 0.1.0
* Requires at least: 6.5
*/
defined( 'ABSPATH' ) || exit;
@ndiego
ndiego / export-github-labels.js
Last active April 12, 2023 11:58
Export Github Labels
/*
Purpose: Export the configuration settings for GitHub Labels.
(c) James Perrin, MIT License, https://www.countrydawgg.com, | @jamesperrin
Modified to pull additional label info from the Gutenberg repo by @ndiego
Exporting Instructions:
1. Open a web browser.
2. Navigate to the desired GitHub repository.
3. Navigate to Issues tab.
@ndiego
ndiego / builder-basics-code-examples.txt
Last active December 14, 2022 13:51
Columns, Groups, Rows, and Stacks: Code Examples
Add the following to the style.css file of the theme.
-------------------------------------------------------------------------------------
// Make the block sticky.
.sticky-column-content {
position: sticky;
top: 60px;
}
// Justify the space between all internal blocks. Add to Stack blocks.
@ndiego
ndiego / block-variations-frost
Last active March 11, 2024 18:12
block-variations-frost
/**
* Add the following to a theme's functions.php file.
*/
function example_enqueue_block_variations() {
wp_enqueue_script(
'frost-enqueue-block-variations',
get_template_directory_uri() . '/assets/js/variations.js',
array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-post' )
);
@ndiego
ndiego / wordcamp-us-2022-presention
Created September 20, 2022 01:42
The complete code for "Let's Build a Custom Block in 15 Minutes" Lighting Talk by Nick Diego presented at WordCamp US 2022.
<!-- wp:cover {"overlayColor":"primary","minHeight":100,"minHeightUnit":"vh","align":"full","className":"is-style-slide","style":{"spacing":{"padding":{"top":"var:preset|spacing|medium","right":"0","bottom":"var:preset|spacing|large","left":"0"},"margin":{"top":"0","bottom":"0"}}},"blockVisibility":{"visibilityPresets":{"presets":[]}}} -->
<div class="wp-block-cover alignfull is-style-slide" style="margin-top:0;margin-bottom:0;padding-top:var(--wp--preset--spacing--medium);padding-right:0;padding-bottom:var(--wp--preset--spacing--large);padding-left:0;min-height:100vh" id="title"><span aria-hidden="true" class="wp-block-cover__background has-primary-background-color has-background-dim-100 has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:group {"layout":{"type":"flex","orientation":"vertical","justifyContent":"left"},"style":{"spacing":{}},"className":"is-style-full-height-stack"} -->
<div class="wp-block-group is-style-full-height-stack"><!-- wp:group {"layout":{"type":"default"
@ndiego
ndiego / block-variation-examples
Last active February 28, 2023 19:36
Block Variation Examples
/**
* Add the following to a theme's functions.php file.
*/
function example_enqueue_block_variations() {
wp_enqueue_script(
'frost-enqueue-block-variations',
get_template_directory_uri() . '/assets/js/variations.js',
array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-post' )
);
@ndiego
ndiego / testimonial-block-pattern-with-locked-blocks
Last active May 19, 2023 15:24
Testimonial Block Pattern with Locked Blocks
<?php
/**
* Title: Testimonials
* Slug: twentytwentytwo/testimonials
* Categories: columns
* Block Types: core/post-content
* Post Types: page
*/
?>