Skip to content

Instantly share code, notes, and snippets.

View Awilson089's full-sized avatar

Adam Wilson Awilson089

View GitHub Profile
@Awilson089
Awilson089 / LocalValetDriver.php
Created February 26, 2024 16:27
Remote image proxy for Valet 4 – Wordpress
<?php
use Valet\Drivers\Specific\WordPressValetDriver;
class LocalValetDriver extends WordPressValetDriver {
/** @var string The remote host to proxy requests to */
const REMOTE_HOST = 'https://remotehost.com/';
/** @var string If the request URI starts with this, we want to proxy the request to the remote host */
const URI_PREFIX = '/wp-content/uploads/';
@Awilson089
Awilson089 / functions.php
Last active August 11, 2023 13:52
Woocommerce email notification for pending order status after 10 minutes
add_filter( 'woocommerce_new_order_email_allows_resend', '__return_true' );
add_action( 'woocommerce_checkout_order_processed', 'pending_new_order_notification', 20, 1 );
function pending_new_order_notification( $order_id ) {
$delayTime = 600;
as_schedule_single_action(time() + $delayTime, 'queue_pending_email', array( $order_id ), 'customActions');
}
@Awilson089
Awilson089 / functions.php
Last active June 13, 2022 08:06
Woocommerce Opayo Payments Custom VendorTXCode
//This function adds last name and the time, then a random number afterwards
add_filter( 'woocommerce_opayopi_vendortxcode', 'custom_vendor_tx_code', 10, 2);
function custom_vendor_tx_code($vendortxcode, $order) {
$vendortxcode = time().$order->get_billing_last_name().rand(0,999 );
$vendortxcode = preg_replace( '/[^0-9a-zA-Z_\-]/', "", $vendortxcode );
// Make sure it's not over 40 characters
@Awilson089
Awilson089 / uk-counties.php
Last active January 15, 2020 10:28
Contact Form 7 List of UK Counties
<?php /* List taken from https://www.jamesharding.net/list-of-uk-counties/ */ ?>
[select your-county include_blank "Bedfordshire" "Berkshire" "Bristol" "Buckinghamshire" "Cambridgeshire" "Cheshire" "Cornwall" "County Durham" "Cumbria" "Derbyshire" "Devon" "Dorset" "East Riding of Yorkshire" "East Sussex" "Essex" "Gloucestershire" "Greater London" "Greater Manchester" "Hampshire" "Herefordshire" "Hertfordshire" "Humberside" "Isle of Wight" "Isles of Scilly" "Kent" "Lancashire" "Leicestershire" "Lincolnshire" "Merseyside" "Norfolk" "North Somerset" "North Yorkshire" "Northamptonshire" "Northumberland" "Nottinghamshire" "Oxfordshire" "Rutland" "Shropshire" "Somerset" "South Gloucestershire" "South Yorkshire" "Staffordshire" "Suffolk" "Surrey" "Tyne & Wear" "Warwickshire" "West Midlands" "West Sussex" "West Yorkshire" "Wiltshire" "Worcestershire" "Aberdeenshire" "Angus" "Argyll & Bute" "Ayrshire" "Banffshire" "Berwickshire" "Borders" "Caithness" "Clackmannanshire" "Dumfries & Galloway" "Dunbartonshire" "East Ayr