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
jQuery('body').removeClass('off-canvas-toggled'); // remove the overflow hidden
jQuery('.oxy-off-canvas').removeClass('oxy-off-canvas-toggled'); // close the offcanvas
jQuery(jQuery('.offcanvas-inner').data('trigger-selector')).find('.hamburger').removeClass('is-active'); // if the trigger is burger, close it
@wplit
wplit / inside repeater code block
Last active June 10, 2020 09:27
am I an even post or an odd post?
<?php
global $counter;
if (0 == $counter % 2) {
// do something if an odd post
echo 'an odd post';
} else {
eyJzb3VyY2UiOiJodHRwOi8vZXh0cmFzIiwiY29tcG9uZW50IjpbeyJpZCI6ODMzLCJuYW1lIjoib3h5X2hlYWRlciIsIm9wdGlvbnMiOnsiY3RfaWQiOjgzMywiY3RfcGFyZW50IjowLCJzZWxlY3RvciI6Il9oZWFkZXItODMzLTYiLCJvcmlnaW5hbCI6eyJzdGlja3ktbWVkaWEiOiJwYWdlLXdpZHRoIiwic3RpY2t5X3Njcm9sbF9kaXN0YW5jZSI6IjAiLCJnbG9iYWxDb25kaXRpb25zUmVzdWx0Ijp0cnVlLCJzdGlja3lfaGVhZGVyIjoibm8iLCJzdGlja3ktYmFja2dyb3VuZC1jb2xvciI6IiNmZmZmZmYiLCJzdGlja3ktYm94LXNoYWRvdyI6Im5vbmUiLCJzdGlja3lfaGVhZGVyX2ZhZGVfaW4iOiJ5ZXMiLCJzdGlja3lfemluZGV4IjoiOTkiLCJjdXN0b20tanMiOiIiLCJnbG9iYWxjb25kaXRpb25zIjpbXSwiYXR0cl81ZWYxZDEyNTE4N2I2IjoiaHR0cHM6Ly9zY2hlbWEub3JnL1dQSGVhZGVyIiwiYXR0cl81ZWYxZDE4NzU0YjY4IjoiaXRlbXNjb3BlIiwib3ZlcmxheS1oZWFkZXItYWJvdmUiOiJuZXZlciJ9LCJhY3RpdmVzZWxlY3RvciI6Im1pbl9oZWFkZXJfMSIsIm5pY2VuYW1lIjoiSGVhZGVyIEJ1aWxkZXIgMSIsImNsYXNzZXMiOlsibWluX2hlYWRlcl8xIl0sImN0X2NhdGVnb3J5IjoiSGVhZGVycyJ9LCJjaGlsZHJlbiI6W3siaWQiOjgzNCwibmFtZSI6Im94eV9oZWFkZXJfcm93Iiwib3B0aW9ucyI6eyJjdF9pZCI6ODM0LCJjdF9wYXJlbnQiOjgzMywic2VsZWN0b3IiOiJfaGVhZGVyX3Jvdy04MzQtNiIsIm9yaWdpbmFsIjp7Imdsb2Jh
@wplit
wplit / code-block.js
Last active August 5, 2020 11:26
scroll with id and offset (and fix for comment reply links not working)
jQuery(document).ready(function($) {
const offset = 0, // change offset (px)
scrollTime = 300; // change scrolling animation time (ms)
$('a[href*="#"]').not('[href="#"]').not('[href="#0"]').not('[href*="replytocom"]').click(function (t) {
if (location.pathname.replace(/^\//, "") == this.pathname.replace(/^\//, "") && location.hostname == this.hostname) {
var e = $(this.hash);
(e = e.length ? e : $("[name=" + this.hash.slice(1) + "]")).length && (t.preventDefault(), $("html, body").animate({ scrollTop: e.offset().top - offset }, scrollTime));
}
@wplit
wplit / gist:d69281d3a14aa21df89486691d5197e3
Created July 31, 2020 05:41
acf pagination video subfields
<?php
/*
* Paginatation on Advanced Custom Fields Repeater
*/
if( get_query_var('page') ) {
$page = get_query_var( 'page' );
} else {
@wplit
wplit / fb.css
Last active August 26, 2020 09:36
fb
body,
#facebook ._-kb.sf {
font-family: avenir!important;
}
.discj3wi {
width: 90%;
}
.aghb5jc5 {
@wplit
wplit / style.css
Created September 4, 2020 04:11
timeline customisations - amanda
/* Even posts background colour */
.timeline_vertical > .ct-div-block:nth-child(even) {
background: blue;
}
/* Add transforms to fade animations */
.timeline_vertical > .ct-div-block:nth-child(even)[data-aos^=fade][data-aos^=fade] {
transform: translateX(50px);
}
@wplit
wplit / snippet.php
Created September 16, 2020 00:35
product list hook for categories
add_action('woocommerce_shop_loop_item_title', 'lit_shop_loop_item_before_title', 5 );
function lit_shop_loop_item_before_title() {
if ( !is_product_category() ) // abort unless we're on a product category
return;
echo 'add something here';
}
@wplit
wplit / stylesheet.css
Created September 22, 2020 04:54
burger triggers sunny
/*
* original CSS for slider burger animation
*/
.hamburger--slider.is-active .hamburger-inner {
transform: translate3d(0, 10px, 0) rotate(45deg); }
.hamburger--slider.is-active .hamburger-inner::before {
transform: rotate(-45deg) translate3d(-5.71429px, -6px, 0);
opacity: 0; }
.hamburger--slider.is-active .hamburger-inner::after {
transform: translate3d(0, -20px, 0) rotate(-90deg); }
@wplit
wplit / code block js
Last active July 23, 2021 00:13
allow carousel builder to work inside tabs
jQuery(document).ready(function($) {
if(window.angular) return;
$('.oxy-tabs').on('click', function() {
let tabContent = '#' + $(this).attr('data-oxy-tabs-contents-wrapper');
let carousels = $(tabContent).find('.oxy-carousel-builder');
carousels.each(function() {