Skip to content

Instantly share code, notes, and snippets.

@Ross7377
Ross7377 / wc-custom_attributes.php
Created July 3, 2020 10:10 — forked from Jany-M/wc-custom_attributes.php
[WP][WooCommerce] Customize attributes & Edit "Variation Swatches" plugin
<?php
/* ------------------------------------------------------------------------------------------------
*
* METHOD 1
*
-------------------------------------------------------------------------------------------------- */
// Customize WooCommerce Attributes (method 1 - no swatches/plugins)
function wc_custom_attr( $product ) {
@Ross7377
Ross7377 / style.css
Created April 27, 2019 18:15
Woocommerce - Flexslider gallery image transition
.woocommerce div.product div.images .woocommerce-product-gallery__wrapper {
-webkit-transition: all cubic-bezier(.795,-.035,0,1) .5s;
transition: all cubic-bezier(.795,-.035,0,1) .5s;
}
@Ross7377
Ross7377 / functions.php
Last active April 26, 2019 22:30
Flexslider - Gallery Paddles (non-active/indicative)
/* === Gallery paddles === */
function paddles() { ?>
<script>
jQuery( function( $ ) {
$( document ).ready(function() {
$('.woocommerce-product-gallery').append('<div><span class="advanc left-paddle hidden"><i class="fas fa-angle-left"></i></span><span class="advanc right-paddle"><i class="fas fa-angle-right"></i></span></div>');
var leftPaddle = document.getElementsByClassName('left-paddle');
var rightPaddle = document.getElementsByClassName('right-paddle');
var itemsLength = $('.woocommerce-product-gallery__image').length;
@Ross7377
Ross7377 / functions.php
Created April 26, 2019 22:25
Owl Carousel - Destroy depending on screen size
function owl_destroy() {
?>
<script>
jQuery( function( $ ) {
$(document).ready(function() {
function owlInitialize() {
if ($(window).width() < 1024) {
$('.products-carousel').owlCarousel();
}else{
@Ross7377
Ross7377 / functions.php
Last active April 26, 2019 18:58
Scrollhint - Add to woocommerce gallery
/* ====== SCROLL-HINT - Load scroll-hint ====== */
function enqueue_scrollhint() {
wp_enqueue_script( 'flick', get_stylesheet_directory_uri() . '/scroll-hint.js', array ( 'jquery' ), 1.1, true);
}
add_action( 'wp_enqueue_scripts', 'enqueue_scrollhint', 30 );
/* ====== SCROLL-HINT - wrap carousel div ====== */
function wrap_div() { ?>
@Ross7377
Ross7377 / functions.php
Last active March 20, 2019 15:08
Woocommerce - Owl Carousel - Lock vertical scroll on touch devices - Solution 3
/* Owl vertical lock */
function owl_scroll() { ?>
<script>
jQuery( function( $ ) {
$( document ).ready( function() {
var tapArea, startX ;
tapArea = document.querySelectorAll('.owl-carousel');
startX = 0;
@Ross7377
Ross7377 / functions.php
Last active March 18, 2019 18:20
Woocommerce - Owl Carousel - Lock vertical scroll on touch devices - Solution 2
/* Load hammer.js
* https://hammerjs.github.io
*/
function enqueue_s() {
wp_enqueue_script( 'script', get_stylesheet_directory_uri() . '/hammer.min.js', array ( 'jquery' ), 1.1, true);
}
add_action( 'wp_enqueue_scripts', 'enqueue_s', 30 );
/* Scroll lock js */
@Ross7377
Ross7377 / functions.php
Last active March 18, 2019 18:12
Woocommerce - Owl Carousel - Lock vertical scroll on touch devices - Solution 1
function owl_scroll() { ?>
<script>
jQuery( function( $ ) {
$( document ).ready( function() {
$('.owl-carousel').bind('touchstart', function(e) {
if ($(e.target).closest('.owl-carousel').length == 1) {
blockMenuHeaderScroll = true;
}
});
$('.owl-carousel').bind('touchend', function() {