Skip to content

Instantly share code, notes, and snippets.

View ndiego's full-sized avatar

Nick Diego ndiego

View GitHub Profile
@ndiego
ndiego / my-pattern-library
Last active September 23, 2024 19:35
My Pattern Library
<?php
/**
* Plugin Name: My Pattern Library
* Description: A simple library of block patterns.
* Version: 0.1.0
* Requires at least: 5.8
* Requires PHP: 7.0
* Author: Your Name
* License: GPL v2 or later
* Text Domain: my-pattern-library
@ndiego
ndiego / register-block-patterns
Created February 21, 2022 11:55
Register Block Patterns
/**
* Register custom patterns.
*/
function example_register_block_patterns() {
register_block_pattern(
'example/feature-grid-light',
array(
'title' => __( 'Feature Grid - Light', 'my-pattern-library' ),
'description' => __( 'Showcase six featured items in a grid on a light background.', 'textdomain' ),
@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
*/
?>
@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 / 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-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 / 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 / export-github-labels.js
Last active September 10, 2024 16:01
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 / 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 / playground-experiment.json
Last active April 19, 2024 21:22
Playground experiment
{
"landingPage": "/wp-admin/site-editor.php",
"preferredVersions": {
"php": "8.0",
"wp": "beta"
},
"features": {
"networking": true
},
"steps": [