Skip to content

Instantly share code, notes, and snippets.

View holisticnetworking's full-sized avatar
😎
Makin' teh codz.

Thomas Belknap holisticnetworking

😎
Makin' teh codz.
View GitHub Profile
@mikedance
mikedance / generate-gutenberg-css.php
Created October 9, 2018 19:50
Generate CSS class rules for custom color palettes and font sizes in WordPress/Gutenberg
/**
* Generate CSS for Gutenberg's has-*-color, has-*-background-color
* and has-*-font-size, based on our colors/sizes. This works on the
* frontend and in the backend editor.
*/
add_action( 'wp_print_scripts', function() {
$string = '<style>';
// color palette
@pento
pento / php-block.js
Last active February 29, 2024 01:31
Converting a shortcode to a block: this method is fast to do, but a mediocre UX. You should only use this as a stopgap until you can implement a full block UI.
// License: GPLv2+
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
TextControl = wp.components.TextControl,
InspectorControls = wp.editor.InspectorControls;
/*
* Here's where we register the block in JavaScript.
@rezen
rezen / wp.filter.php
Created August 18, 2012 17:05
Filter Image insert for WordPress
function xf_insert_image( $html, $id, $caption, $title, $align, $url )
{
$html5 = "<figure id='post-$id media-$id' class='align-$align'>";
$html5 .= "<img src='$url' alt='$title' />";
$html5 .= "<figcaption>$caption</figcaption>";
$html5 .= "</figure>";
return $html5;
}