Skip to content

Instantly share code, notes, and snippets.

View wplit's full-sized avatar
💭
I may be slow to respond.

David Browne wplit

💭
I may be slow to respond.
View GitHub Profile
@wplit
wplit / code.php
Last active January 30, 2026 05:55
example code, queuing a toast on WooCommerce' redirect hook
<?php
add_filter( 'woocommerce_add_to_cart_redirect', 'show_add_to_cart_toast', 10, 1 );
function show_add_to_cart_toast( $url ) {
$product_id = absint( $_REQUEST['add-to-cart'] ?? 0 );
if ( $product_id ) {
$product = wc_get_product( $product_id );
@wplit
wplit / footer-scripts.html
Last active January 26, 2026 00:06
'autoplay' the before/after --x-before-after-position variable until user interaction
@wplit
wplit / footer-scripts.html
Created January 22, 2026 21:50
attempt to play player when playlist item clicked
@wplit
wplit / bricksextras.pot
Last active January 22, 2026 02:40
BricksExtras translations POT file (for in-builder / admin translations)
# Copyright (C) 2026 BricksExtras
# This file is distributed under the same license as the BricksExtras plugin.
msgid ""
msgstr ""
"Project-Id-Version: BricksExtras\n"
"Report-Msgid-Bugs-To: https://bricksextras.com\n"
"POT-Creation-Date: 2026-01-21 01:05+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@wplit
wplit / code.php
Created January 17, 2026 00:21
add new breadcrunk link to breadcrumbs
<?php
add_filter( 'bricksextras/breadcrumbs/', function( $crumbs ) {
$crumbPosition = 1;
$url = 'https://kevinc366.sg-host.com/tournaments/';
$text = 'Tournaments';
/* if single event, add new breadcrumb */
@wplit
wplit / code.php
Last active January 10, 2026 21:24
Redirect WordPress search to WPGB search format
<?php
/**
* Redirect WordPress search to WPGB search format
*/
add_action('template_redirect', function() {
if (isset($_GET['s']) && !empty($_GET['s'])) {
$search_query = sanitize_text_field($_GET['s']);
@wplit
wplit / footer-scripts.html
Last active December 29, 2025 00:30
do something when page tour step hides
@wplit
wplit / footer-scripts.html
Last active December 11, 2025 04:06
re-init page tour after WSForm has initialsed so the elements exist
@wplit
wplit / style.css
Created December 6, 2025 02:08
add fade to either side of the slider depending on if first/last slide is visible. (add to element CSS settings)
%root% .splide__track {
--x-slider-mask-edge: 20%;
--x-slider-mask-edge-slope: 2;
mask-image: linear-gradient(to right, black 0%, black 100%);
-webkit-mask-image: linear-gradient(to right, black 0%, black 100%);
}
@wplit
wplit / footer-scripts.html
Created December 5, 2025 00:57
clear header search input value when opened