This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const remote_domain = 'DOMAIN', // without trailing slash | |
application_password = 'APPLICATION PASSWORD', | |
username = 'USERNAME'; | |
const headers = new Headers({ | |
'Content-Type': 'application/json', | |
'Authorization': 'Basic ' + btoa(username + ':' + application_password) | |
}); | |
const makePost = async function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const remote_domain = 'https://example.org', // without trailing slash | |
application_password = 'Application password', | |
username = 'remote_user_name'; | |
const body = JSON.stringify({ | |
title: 'Post using REST API', | |
content: 'Post content using REST API', | |
status: 'publish' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace SayHello\Theme\Pattern; | |
/** | |
* Manage single block pattern | |
* | |
* @author Say Hello GmbH <[email protected]> | |
*/ | |
class ThreeColumns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace SayHello\Theme\Pattern; | |
/** | |
* Manage single block pattern | |
* | |
* @author Say Hello GmbH <[email protected]> | |
*/ | |
class GroupWithMediaText |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set alignment options for cover, video, and paragraph blocks. | |
wp.hooks.addFilter( | |
'blocks.registerBlockType', | |
'hd-theme/hd-theme', | |
function( settings, name ) { | |
if ( name === 'core/cover' || name === 'core/video' || name === 'core/paragraph' || name === 'core/list' ) { | |
return lodash.assign( {}, settings, { | |
supports: lodash.assign( {}, settings.supports, { | |
// allow support for full and wide alignment. | |
align: ['full', 'wide'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- wp:columns --> | |
<div class="wp-block-columns"><!-- wp:column --> | |
<div class="wp-block-column"><!-- wp:image {"id":62096,"sizeSlug":"medium","linkDestination":"none"} --> | |
<figure class="wp-block-image size-medium"><img src="https://permanenttourist.ch/wp-content/uploads/2021/10/20211024-DSCF1065-768x768.jpg" alt="" class="wp-image-62096"/><figcaption>Image caption</figcaption></figure> | |
<!-- /wp:image --> | |
<!-- wp:heading {"level":3} --> | |
<h3 id="card-title">Card title</h3> | |
<!-- /wp:heading --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* WordPress Core currently assigns the CSS Custom Properties | |
* to the HTML body element, so CSS Custom Properties assigned | |
* to :root cannot access them. This is defined by WP_Theme_JSON::ROOT_BLOCK_SELECTOR | |
* which (at the date of writing) cannot be hooked or modified | |
* by external means. | |
* | |
* This script replaces the assignment from body {…} to :root {…} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Overwrite/bypass <iframe></iframe> height limit imposed by Wordpress | |
* Original idea from bypass-iframe-height-limit plugin by Justin Carboneau | |
* Adapted from original /wp-includes/js/wp-embed.js | |
*/ | |
(function(window, document) { | |
'use strict'; | |
var supportedBrowser = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace SayHello\Theme\Block; | |
/** | |
* Customisation of the Core Post Title block | |
* Find the original core rendering at e.g. wp-includes/blocks/post-title.php | |
* | |
* @author Mark Howells-Mead <[email protected]> | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Example code for a scrolling IntersectionObserver | |
* Original by Keith Devon https://highrise.digital/blog/animating-blocks-on-scroll-with-intersection-observer/ | |
* | |
*/ | |
document.addEventListener('DOMContentLoaded', () => { | |
// get all the scroll-group elemetns. | |
const scrollGroups = document.querySelectorAll('[class*="scroll-group"]'); |