This file contains 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 MyPlugin; | |
add_filter( 'render_block_core/heading', __NAMESPACE__ . '\\add_anchor_icon', 10, 2 ); | |
/** | |
* Add clickable anchor icons to all core/paragragh blocks. | |
* | |
* @param string $block_content The block content about to be appended. |
This file contains 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
# Script to convert a list of CSS custom properties to the JSON format required by Advanced Themer to make them appear on the Bricks Builder fields (via the “V” symbol). | |
# 1. Add a file in a folder with all CSS variables from Core Framework called core-framework-css-variables.css, one per line. Group each section using CSS comments. | |
# 2. Run the python script to generate the JSON file for Advanced Themer: python3 convert-css-variables-to-json.py | |
# 3. Add the file to the “Import Framework” option of the Advanced Themer on Bricks → AT - Theme settints → Global CSS Variables → Import Framework. | |
import re | |
import json | |
# Read the CSS file | |
with open('core-framework-css-variables.css', 'r') as f: | |
css = f.readlines() |
This file contains 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 | |
/** | |
* Fetches remote data with dual-layer caching. | |
* | |
* Uses wp_remote_get to fetch remote data. The data is cached twice: it's | |
* stored in a transient and an option. The transient is used as the main cache | |
* but if the transient has expired and the remote site doesn't respond, | |
* backup data from the option is returned. | |
* |
This file contains 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
var recursivelyRecoverInvalidBlockList = blocks => { | |
const _blocks = [ ...blocks ] | |
let recoveryCalled = false | |
const recursivelyRecoverBlocks = willRecoverBlocks => { | |
willRecoverBlocks.forEach( _block => { | |
if ( isInvalid( _block ) ) { | |
recoveryCalled = true | |
const newBlock = recoverBlock( _block ) | |
for ( const key in newBlock ) { | |
_block[ key ] = newBlock[ key ] |
This file contains 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:group {"style":{"color":{"background":"#ffae0017"},"spacing":{"padding":{"top":"0","right":"0","bottom":"0","left":"0"}},"border":{"left":{"color":"#fcb90033","width":"8px"}}},"layout":{"type":"constrained"}} --> | |
<div class="wp-block-group has-background" style="border-left-color:#fcb90033;border-left-width:8px;background-color:#ffae0017;padding-top:0;padding-right:0;padding-bottom:0;padding-left:0"> | |
<!-- wp:columns {"isStackedOnMobile":false,"style":{"spacing":{"padding":{"top":"0px","right":"0px","bottom":"0px","left":"0px"},"blockGap":{"top":"0px","left":"0px"},"margin":{"top":"0px","bottom":"0px"}}}} --> | |
<div class="wp-block-columns is-not-stacked-on-mobile" style="margin-top:0px;margin-bottom:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px"> | |
<!-- wp:column {"width":"40px","layout":{"type":"default"}} --> | |
<div class="wp-block-column" style="flex-basis:40px"> | |
<!-- wp:image {"sizeSlug":"large","linkDestination":"none","className":"is-styl |
This file contains 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
:: This batch file converts HTML files in a folder to docx. | |
:: It requires Pandoc, and a list of files to convert | |
:: named file-list, in which each file is on a separate line, | |
:: and contains no spaces in the filename. | |
:: | |
:: Don't show these commands to the user | |
@ECHO off | |
:: Set the title of the window | |
TITLE Convert html to docx | |
:: This thing that's necessary. |
This file contains 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 | |
/** | |
* @link | |
* @since 1.0.0 | |
* @package TODO | |
* | |
* @wordpress-plugin | |
* Plugin Name: Use MailHog | |
* Description: Configure WordPress on Valet to use MailHog | |
* Version: 1.0.0 |
This file contains 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 MyPlugin; | |
// Adds a class to external links in content blocks. | |
add_filter( 'render_block', __NAMESPACE__ . '\\add_class_external_links', 10, 2 ); | |
/** | |
* Adds a CSS class to external links in content blocks. | |
* |
NewerOlder