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 / style.css
Last active May 14, 2026 05:44
some css for styling arrows in structure panel
/* to make them more visible (default was 0.4) */
#bricks-structure .structure-item svg {
opacity: 1;
}
/* to change the color of the arrows */
#bricks-structure .toggle svg {
color: red;
}
@wplit
wplit / code.php
Created March 21, 2026 06:49
test nestable element
<?php
class X_Test_Element extends \Bricks\Element {
// Element properties
public $category = "general";
public $name = "xtestelement";
public $icon = "ti-layout-width-full";
public function get_label() {
return esc_html__("Test element", "bricks");
@wplit
wplit / footer-scripts.html
Last active March 18, 2026 04:11
prevent tabbing to open toggle if header search open
@wplit
wplit / footer-scripts.html
Created March 15, 2026 22:19
listen for bricks' accordion item opening, when that happens re-run the readmore
@wplit
wplit / code.php
Created March 6, 2026 03:34
example custom function outputting two custom field values
<?php
function your_custom_function() {
$output = '<p>' . get_field( 'acf_field_one' ) . '</p>';
$output .= '<p>' . get_field( 'acf_field_two' ) . '</p>';
return $output;
};
@wplit
wplit / footer-scripts.html
Last active March 4, 2026 23:03
re-init readmore element when bricks tabs open
@wplit
wplit / footer-scripts.html
Created March 3, 2026 01:15
run the panorama init function when the popover opens
@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;