Skip to content

Instantly share code, notes, and snippets.

View colorful-tones's full-sized avatar
💓
Don’t believe the hype!

Damon Cook colorful-tones

💓
Don’t believe the hype!
View GitHub Profile
function qorp_about_block_template_lookup( $template, $type, array $templates ) {
if ( $template && 'page-about.php' === $templates[0] ) {
add_filter( 'the_content', 'qorp_append_post_meta_output' );
}
}
add_filter( 'page_template', 'qorp_about_block_template_lookup', 20, 3 );
function qorp_append_post_meta_output( $content ) {
ob_start();
/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot
<!-- wp:template-part {"slug":"header","tagName":"header","className":"site-header"} /-->
<!-- wp:group {"tagName":"main","className":"site-content","style":{"spacing":{"margin":{"top":"0"}}}} -->
<main class="wp-block-group site-content" style="margin-top:0">
<!-- wp:pattern {"slug":"frost/page-home"} /-->
</main>
<!-- /wp:group -->
<!-- wp:template-part {"slug":"footer","tagName":"footer","className":"site-footer"} /-->
@colorful-tones
colorful-tones / block.json
Last active August 11, 2021 16:36
Block template for InnerBlocks
{
"apiVersion": 2,
"name": "namespace/carousel",
"title": "Carousel",
"category": "custom-category",
"icon": "slides",
"keywords": [ "carousel", "slider" ],
"description": "Add a swipeable carousel of content.",
"supports": {
"html": false
@colorful-tones
colorful-tones / arrow-left.js
Last active July 2, 2021 17:08
SVG Icon block
import { SVG, Path } from '@wordpress/components';
const arrowLeft = (
<SVG fill="none" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
<Path
d="m1.333 14.389 9.466-9.466c.872-.872 2.326-.872 3.198 0s.872 2.326 0 3.198l-5.589 5.621h20.677c1.26 0 2.262 1.002 2.262 2.261s-1.002 2.262-2.262 2.262h-20.677l5.589 5.589c.872.872.872 2.326 0 3.198-.452.452-1.034.678-1.615.678s-1.163-.226-1.615-.678l-9.434-9.434c-.42-.42-.678-1.002-.678-1.615s.226-1.195.678-1.615z"
fill="currentColor"
/>
</SVG>
);
@colorful-tones
colorful-tones / customizer.php
Last active March 17, 2020 04:40
Child theme for Go - includes custom Customizer options
<?php
/**
* Customizer setup
*
* @package YourChildTheme
*/
namespace YourChildTheme\Customizer;
/**
@colorful-tones
colorful-tones / gutenberg-sample-content.html
Last active February 21, 2019 00:36 — forked from mailenkno/gutenberg-sample-content.html
WordPress Gutenberg Sample Content
<!-- wp:heading {"level":1} -->
<h1>This is a heading (H1)</h1>
<!-- /wp:heading -->
<!-- wp:heading -->
<h2>This is a heading (H2)</h2>
<!-- /wp:heading -->
<!-- wp:heading {"level":3} -->
<h3>This is a heading (H3)</h3>
@colorful-tones
colorful-tones / variables.css
Last active November 1, 2018 13:14
CSS color variables
:root {
/* Set initial saturation and lightness values */
--sat: 50%;
--light: 50%;
/* Set amount of light & saturation to change for darker & lighter color variants */
--shader: 15%;
/* Calculate saturation values for lighter & darker color variations */
--satDarker: calc(var(--sat) + var(--shader));
@colorful-tones
colorful-tones / foobar.css
Created October 31, 2018 18:24
CSS variables: valid vs invalid values
:root {
--my-var: 🎃;
}
.foo {
color: var(--my-var);
}
@colorful-tones
colorful-tones / foo.css
Created October 31, 2018 18:22
CSS variables with fallback value
.foo {
color: var(--my-var, red); /* Red if --my-var is not defined */
}