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.js
Created June 30, 2026 09:18
prevent fancybox from scrolling gallery with wheel
document.addEventListener('DOMContentLoaded', function() {
if (window.jQuery && window.jQuery.fancybox) {
jQuery(document).on('onInit.fb', function(e, instance) {
if (instance && instance.$refs && instance.$refs.stage) {
instance.$refs.stage.off('mousewheel DOMMouseScroll wheel MozMousePixelScroll');
instance.$refs.stage.on('mousewheel DOMMouseScroll wheel MozMousePixelScroll', function(e) {
e.preventDefault();
@wplit
wplit / code.js
Created June 28, 2026 01:07
click hotspot marker when link is clicked/hovered
document.addEventListener('DOMContentLoaded', function() {
const links = document.querySelectorAll('.my-link');
const popoverButtons = document.querySelectorAll('#%%ELEMENT_ID%% .oxy-popover_marker');
links.forEach((link, index) => {
const correspondingButton = popoverButtons[index];
if (correspondingButton) {
// Click handler
@wplit
wplit / footer-scripts.html
Last active May 29, 2026 06:43
set number of decimal places for values in pie chart - add to page settings > custom code > footer scripts
@wplit
wplit / code.php
Last active May 20, 2026 01:09
remove glossary-hovercards scripts where it's not needed (which in turn, removes the tippy dependancy)
<?php
add_action( 'wp_footer', function() {
// Option 1: Remove on specific pages
if ( is_page( array( 'your-page-slug', 'another-page' ) ) ) {
wp_dequeue_script( 'glossary-hovercards' );
wp_deregister_script( 'glossary-hovercards' );
}
@wplit
wplit / footer-scripts.html
Last active May 19, 2026 08:02
change calendar locale to match site language.
@wplit
wplit / footer-scripts.html
Created May 11, 2026 05:46
auto-scroll to expanded accordion/tab when expanded
@wplit
wplit / footer-scripts.html
Created May 11, 2026 01:07
change morelength on lightbox
@wplit
wplit / array.php
Last active May 1, 2026 03:18
Example looping through an 'event' post type, and then an acf repeater 'event_repeater' inside each event
<?php
function my_get_calendar_events() {
// Custom post type slug
$post_type = 'event';
// ACF field names (post-level)
$field_color = 'event_color';
$field_start = 'event_start_date';
@wplit
wplit / acf.json
Last active May 6, 2026 01:56
event acf fields
[
{
"key": "group_xcalendar_events",
"title": "Event Fields",
"fields": [
{
"key": "field_xcalendar_basic_info_tab",
"label": "Event Details",
"name": "",
"aria-label": "",
@wplit
wplit / footer-scripts.html
Created April 7, 2026 22:09
force bricks to recalc sub menu position when header sticky/unsticky