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 7, 2024 23:32
<?php
function maybePostLink( $field ) {
$loopObject = \Bricks\Query::get_loop_object();
if ( ! is_array( $loopObject ) ) return false;
$post_id = $loopObject[$field] ?? ''; // actual field
@wplit
wplit / footer-scripts.html
Created February 5, 2024 23:57
run bricks' interactions Bricks after slider initialised
@wplit
wplit / footer-scripts.html
Last active February 3, 2024 00:11
reverse y axis on dynamic chart
@wplit
wplit / footer-script.html
Created February 1, 2024 23:19
Open all accordions above breakpoint, close below breakpoint
@wplit
wplit / codeblock.js
Created January 31, 2024 09:26
make browser scroll to new position of accordion header if clicked
jQuery(document).ready(function($) {
/* variables to customise */
let animationDuration = 400; /* animation duration for scrolling */
let animationTimeout = 400; /* how long to wait before scrolling the user, needs to be long enough for page to finish changing height */
let scrollOffset = 100; /* the gap between the top of the viewport to the opened accordion item */
$('.oxy-pro-accordion_header').on('click', function() {
let hash = '#' + $(this).attr('ID');
@wplit
wplit / footer-script.html
Last active January 24, 2024 23:12
take the image from active slide and change the background image of section
@wplit
wplit / code.js
Last active January 24, 2024 05:21
Play media player when mouseover (pro media player > JS)
jQuery(document).ready(function($) {
const player = document.querySelector('#%%ELEMENT_ID%% vime-player');
player.addEventListener('mouseenter', () => {
player.play();
});
@wplit
wplit / code-block.php
Created January 19, 2024 02:50
ACF gallery inside carousel
<?php
$images = get_field('gallery');
if( $images ): ?>
<?php foreach( $images as $image ): ?>
<div class="cell">
<img src="<?php echo esc_url($image['sizes']['thumbnail']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
@wplit
wplit / footer-script.html
Created January 17, 2024 22:05
tabs events
@wplit
wplit / style.css
Last active January 17, 2024 09:43
alternative
%root% {
clip-path: inset( -100vw 0 -100vw -100vw );
position: relative;
}
%root%::after {
content: '';
border-top: 4px solid;
position: absolute;
bottom: calc(-1 * var(--space-xs));