Skip to content

Instantly share code, notes, and snippets.

View doubleedesign's full-sized avatar

Leesa Ward doubleedesign

View GitHub Profile
@doubleedesign
doubleedesign / _local-to-herd.md
Last active October 6, 2025 00:18
Local by Flywheel + Laravel Herd, best of both worlds!

Local by Flywheel + Laravel Herd

Best of both worlds! Use Local for pushing and pulling and Herd for local development (so you can use the Dumps window and test emails).

If you put these in your herd bin folder, you can run "local-to-herd" from anywhere to transfer the site's database and link the install to Herd's server, and "local-export-db" to copy the db back from Herd to Local.

@doubleedesign
doubleedesign / ._herdpress.md
Last active July 20, 2025 00:31
New WordPress site setup with Laravel Herd and custom blueprint

HerdPress

WordPress local dev site setup automation for Laravel Herd.

Kind of like wp-env but without Docker, enabling you to use Herd's debugging and mail catching + inspection capabilities. Also supports installing ClassicPress instead of WordPress.

For Windows + PowerShell users.

Not affiliated with or endorsed by Beyond Code (the makers of Laravel Herd).

@doubleedesign
doubleedesign / acf-tsf-integration.php
Last active May 17, 2025 19:46
Get meta descriptions in The SEO Framework from ACF flexible content fields
<?php
/**
* The SEO Framework + ACF flexible content integration
* TSF will look at the excerpt and then the content to generate the default meta description.
* If both of those are empty, this code looks for ACF flexible modules to get it from.
* // TODO: Make this work with archives as well as posts
* @param $description
* @param $args
*
* @return mixed|string
@doubleedesign
doubleedesign / manager.ts
Created December 30, 2024 09:32
Log all Storybook events to the browser console for debugging
import { addons } from '@storybook/manager-api';
import events from '@storybook/core-events';
addons.register('my-manager-addon', () => {
const channel = addons.getChannel();
Object.values(events).forEach((event) => {
channel.on(event, (data) => {
console.log(event, data);
});
@doubleedesign
doubleedesign / xdebug-markup.js
Created November 17, 2024 02:47
Customised Xdebug output styling
/**
* Customise some of the HTML output of xdebug + add highlightjs + hackily customise that
* Requires:
* - HighlightJS: https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js
* - HighlightJS PHP: https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/languages/php.min.js
* - Optionally, a base theme, e.g., https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github.min.css
**/
document.addEventListener('DOMContentLoaded', function () {
const codeBlocks = document.querySelectorAll('.xdebug-error td:nth-of-type(4)');
if(codeBlocks.length) {
@doubleedesign
doubleedesign / _export-orders.php
Last active March 19, 2024 10:05
Export selected data about the currently shown WooCommerce orders to a CSV file
<?php
/**
* Function to export the orders list to a CSV download (not stored anywhere)
* CSV construction based on https://gist.github.com/vrushank-snippets/4274500
* Dev notes:
* - This file is designed to be called via AJAX, with that function providing the order IDs.
* - To use this without AJAX you would just need to define $order_ids = wp_list_pluck($wp_query->posts, 'ID') instead,
* and define $filename as something appropriate here.
*/
function doublee_export_orders() {
# ZSH Theme based on Solus (https://gist.github.com/cloudnull/4cc7890acaae6cb809e811e09e9eaade#file-solus-zsh-theme)
# Modified with custom colours
# See https://coderwall.com/p/pb1uzq/z-shell-colors for colour codes
if [[ $UID -eq 0 ]]; then
local user_symbol='%F{196}#%f'
else
local user_symbol='%F{226}$%f'
fi
@doubleedesign
doubleedesign / breadcrumbs-list.php
Created December 4, 2018 00:52
Mark up Yoast breadcrumbs as an unordered list
<?php
/**
* Filter the output of Yoast breadcrumbs so each item is an <li> with schema markup
* @param $link_output
* @param $link
*
* @return string
*/
function doublee_filter_yoast_breadcrumb_items( $link_output, $link ) {
@doubleedesign
doubleedesign / previous-sibling.scss
Last active January 28, 2024 10:47
CSS previous sibling selector example
// I have sections (called blocks here) that should have top and bottom padding,
// unless two of the same kind with the same background colour are together -
// in which case I want them to be right up next to each other - no padding between them.
// In the HTML it looks something like this:
// <section class="block my-special-block has-primary-background-color">
.block {
padding-top: map-get($spacing, 'lg');
padding-bottom: map-get($spacing, 'lg');
}
@doubleedesign
doubleedesign / checkout-functions.php
Created May 17, 2019 06:50
Add reCaptcha v2 to WooCommerce Checkout
<?php
/**
* Add reCaptcha to checkout form
* Note: Can't place within the payment part of the form, WooCommerce just won't show it, choose an appropriate action to add it to accordingly
* @param $checkout
*/
function doublee_show_me_the_checkout_captcha($checkout) {
echo '<div class="g-recaptcha" data-sitekey="YOUR_KEY_HERE"></div>';
}
add_action('woocommerce_checkout_order_review', 'doublee_show_me_the_checkout_captcha', 18);