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
Created June 27, 2025 00:31
do copy to clipboard on popover opening
@wplit
wplit / style.css
Created June 19, 2025 01:44
example CSS for moving aspect-ratio onto media-provider inside player
/* remove aspect ratio from player and set variable for controlling top margin */
%root% {
aspect-ratio: unset;
--player-controls-top: 6rem;
}
/* add aspect ratio to the media provider and set margins */
%root% media-provider {
position: relative;
@wplit
wplit / footer-scripts.html
Last active June 5, 2025 00:58
move focus automatically when modal open
@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);
});
});