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-block.js
Last active March 8, 2021 06:07
Allow lightbox components to work with ajax loaded content if lightbox not inside the content
jQuery('.oxy-dynamic-list').on( 'append.infiniteScroll', function( event, body, path, items, response ) {
doExtrasLightbox(jQuery('body'));
});
@wplit
wplit / code-block.js
Last active March 17, 2021 23:27
add status to carousel builder (add to code block)
jQuery(document).ready(function($) {
let carouselSelector = '.my-carousel'; /* Change to your carousel class */
let statusSelector = '.oxy-carousel-builder_status'; /* Change to your text component class */
let $carousel = $(carouselSelector).find($(carouselSelector).children().data('carousel'));
var flkty = $carousel.data('flickity');
if (flkty) {
function updateStatus() {
@wplit
wplit / code-block.php
Created March 10, 2021 03:50
output woocommerce gallery images. (inside product builder inside a code block)
<?php
global $product;
$image_size = 'medium'; /* Image size */
$attachment_ids = $product->get_gallery_image_ids();
foreach( $attachment_ids as $attachment_id ) {
@wplit
wplit / code-block.js
Last active March 11, 2021 23:55
Ensure readmore & lightbox functionality is added to new content when WPGridBuilder facets append new content.
window.WP_Grid_Builder && WP_Grid_Builder.on( 'init', onInit );
function onInit( wpgb ) {
wpgb.facets.on( 'appended', onAppended );
}
function onAppended( content ) {
/* Do Lightbox */
if (typeof doExtrasLightbox == 'function') {
@wplit
wplit / snippet.php
Created March 15, 2021 10:01
limit search results to only show products
/* Filter search query to only display products */
add_filter('pre_get_posts','lit_search_products_only');
function lit_search_products_only($query) {
if ($query->is_search && !is_admin() ) {
$query->set('post_type',array('product'));
}
return $query;
@wplit
wplit / fluent-form.js
Last active March 22, 2021 01:07
Do something when OxyExtras Fluent Form is submitted (add to fluent form component > advanced > javascript)
(function($){
$('#%%ELEMENT_ID%% form').on('fluentform_submission_success', function() {
/* Do something here like triggering a click on the trigger for the lightbox */
$( ".click-trigger" ).click();
});
}(jQuery));
@wplit
wplit / slide-menu.js
Last active March 22, 2021 03:02
Make top-level menu items from slide menu be included in the offcanvas stagger effect ( add to slide menu > advanced > javascript)
jQuery('#%%ELEMENT_ID%%').find('.oxy-slide-menu_list > .menu-item').attr( {
"data-aos":"fade-left" /* Change to the effect you want */
} );
@wplit
wplit / code-block.js
Last active March 26, 2021 04:27
slide menu & icon opening on hover, closing on click
/* Opens slidemenu if hovering the icon or inside the slide menu */
jQuery('#-slide-menu-20-28,#fancy_icon-18-28').hover(function () {
jQuery('#-slide-menu-20-28').stop().slideDown();
}, function(){
/* If you wanted to close when user moves cursor outside of the menu or icon */
//jQuery('#-slide-menu-20-28').stop().slideUp();
});
/* Close slidemenu when clicking on the page somewhere that isn't the menu or icon */
jQuery(document).on("click", function(e){
@wplit
wplit / code-snippet.php
Created April 7, 2021 06:25
apply shortcode from fluent forms as function
/* Return the shortcode */
function fluent_form_submission_count($id) {
return do_shortcode('[fluentform_info id="'. $id .'" info="submission_count"]');
}
@wplit
wplit / js.js
Created April 16, 2021 08:29
click to go to specific cell (add to button/link directly, advanced > javascript)
jQuery(document).ready(function($) {
let carouselSelector = '.my-carousel'; /* Change to your carousel class */
let index = 3; /* Change to needed cell index */
$('#%%ELEMENT_ID%%').on('click', function(e) {
e.preventDefault()
$(carouselSelector).find($(carouselSelector).children().data('carousel')).flickity( 'select', index, false, true );
});