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 / footer-scripts.html
Last active May 30, 2025 01:22
force iOS to display keyboard when header search open
@wplit
wplit / footer-scripts.html
Created May 21, 2025 23:06
re-run cursor when filter ajax ends
@wplit
wplit / footer-scripts.html
Last active May 20, 2025 23:54
add any image URLs to a lightbox gallery (page settings > custom code > footer scripts)
@wplit
wplit / footer-scripts.html
Last active May 20, 2025 12:42
allow bricks photoswipe lightbox to work for content added by dynamic lightbox
@wplit
wplit / code.js
Created May 20, 2025 11:58
bricks' JS functions
bricksNavMenu(),
bricksMultilevelMenu(),
bricksNavMenuMobile(),
bricksStickyHeader(),
bricksOnePageNavigation(),
bricksSkipLinks(),
bricksFacebookSDK(),
bricksSearchToggle(),
bricksPopups(),
bricksSwiper(),
@wplit
wplit / code.php
Created May 12, 2025 12:28
add favorites column to posts screen
<?php
// Add a custom column to display favorite count of each post
add_filter('manage_post_posts_columns', 'add_favorited_users_column');
function add_favorited_users_column($columns) {
$columns['favorited_users'] = 'Favorited Count';
return $columns;
}
@wplit
wplit / code.php
Created May 7, 2025 04:18
prevent speculation rules from blocking lighthouse
<?php
add_filter('wp_speculative_loading_enabled', '__return_false');
remove_action('wp_head', 'wp_output_speculationrules_script');
add_action('template_redirect', function () {
ob_start(function ($html) {
return preg_replace('/<script type="speculationrules".*?<\/script>/is', '', $html);
});
});
@wplit
wplit / code.php
Last active April 25, 2025 03:45
example changing breadcrumb
<?php
add_filter( 'bricksextras/breadcrumbs/', function( $crumbs ) {
/* only change if on singular service post */
if ( is_singular('service') ) {
$url = '/services';
$label = 'Services';
@wplit
wplit / code.php
Created April 17, 2025 05:43
prevent fluent support outputting all support portal JS on the front end
add_action('wp_enqueue_scripts', function() {
// Only allow on /support page for logged-in users
if (!is_user_logged_in() || !is_page('support')) {
wp_dequeue_script('fluent-support/customer-portal');
}
}, 999);
@wplit
wplit / v.js
Created April 15, 2025 00:07
fix vidstack PIP issue
// Fix for PIP button issue with multiple players
function fixPIPMediaSessionIssue() {
// Keep track of which player is currently in PIP mode
let pipPlayer = null;
// Store original mediaSession handlers
const originalHandlers = {};
// Function to capture and store the original mediaSession handlers
function captureOriginalHandlers() {