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 February 26, 2026 22:46
FluentCart Product Transaction Hash Lookup, add to child theme functions.php
<?php
/**
* FluentCart Product Transaction Hash Lookup
*
* @param int $product_id The product ID to check for
* @return string The transaction hash if product was just purchased
*/
function get_fluentcart_product_trx_hash( $product_id ) {
@wplit
wplit / code.js
Created February 26, 2026 03:58
disable the prev button if carousel on first slide, and add class 'nav-disabled' to button for styling it when disabled.
jQuery(document).ready(function($) {
if($('html').attr('ng-app') == 'CTFrontendBuilder') return;
var $carouselElement = $("#%%ELEMENT_ID%%");
var carousel = $carouselElement.find($carouselElement.children().data("carousel"));
if (carousel && carousel.length) {
var $carouselInner = $carouselElement.find('.oxy-carousel-builder_inner');
@wplit
wplit / code.js
Created February 25, 2026 09:57
Change colors on <canvas> when core framework theme mode toggle clicked
// Watch for class changes on html tag
if (!window.xClassChangeObserverAdded) {
window.xClassChangeObserverAdded = true;
let previousTheme = document.documentElement.classList.contains('cf-theme-dark') ? 'dark' : 'light';
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
const classList = document.documentElement.classList;
@wplit
wplit / footer-scripts.html
Created February 24, 2026 00:20
re-run media functon when core framework changes theme color
@wplit
wplit / footer-scripts.html
Created February 23, 2026 06:34
force everything outside of open offcanvas to be none-focusable (add to page settings > custom code > footer scripts)
@wplit
wplit / footer-scripts.html
Created February 20, 2026 00:08
find all read more links in slider and collapse when slider changes active slide
@wplit
wplit / footer-scripts.html
Last active February 18, 2026 09:33
reset iframe from previous slide when moving between slides in lightbox
@wplit
wplit / subtitles.vtt
Created February 7, 2026 04:49
subtitles.vtt
WEBVTT
1
00:00:00.666 --> 00:00:02.416
Every business starts somewhere
2
00:00:02.625 --> 00:00:04.375
And
@wplit
wplit / code.php
Last active February 5, 2026 23:01
Add admin column to show favorited count next to each post, change 'product' to any post type
<?php
// Array of post types to include the column
function x_favorite_post_types() {
return [
'product' /* product post type */
];
}
@wplit
wplit / code.php
Created February 3, 2026 05:16
add little css notice to bricks components in gutenberg (code snippet)
<?php
add_action('enqueue_block_editor_assets', function() {
wp_add_inline_style('wp-edit-blocks', '
.wp-block[data-type*="bricks-component"] > div::after,
.wp-block[data-type*="default/gutenb"] > div::after {
content: "See additional settings in the sidebar on the right";