Skip to content

Instantly share code, notes, and snippets.

View seb86's full-sized avatar
🚀

Sébastien Dumont seb86

🚀
View GitHub Profile
@seb86
seb86 / woocommerce_products_sold_single_product.php
Created May 17, 2016 18:14 — forked from kloon/woocommerce_products_sold_single_product.php
WooCommerce display number of products sold on single product page
<?php
add_action( 'woocommerce_single_product_summary', 'wc_product_sold_count', 11 );
function wc_product_sold_count() {
global $product;
$units_sold = get_post_meta( $product->id, 'total_sales', true );
echo '<p>' . sprintf( __( 'Units Sold: %s', 'woocommerce' ), $units_sold ) . '</p>';
}
?>
@seb86
seb86 / wp-install-core-sub-dir.sh
Created April 6, 2017 20:55 — forked from polevaultweb/wp-install-core-sub-dir.sh
This script installs WordPress inside a sub directory
#!/bin/bash
# Installation:
# Install the script in one of the folders in your PATH. Make sure it has execute permissions (i.e. chmod +x wp-install-core-sub-dir).
#Usage:
# $ mkdir mysite
# $ cd mysite
@seb86
seb86 / gist:a5446e0608e79e66b42b569cdcad9925
Created August 21, 2017 13:42 — forked from woogist/gist:5692886
Sample WooCommerce Points & Rewards 3rd Party Plugin Integration
<?php
// Add the action setting
add_filter( 'wc_points_rewards_action_settings', 'points_rewards_newsletter_action_settings' );
function points_rewards_newsletter_action_settings( $settings ) {
$settings[] = array(
'title' => __( 'Points earned for newsletter signup' ),
'desc_tip' => __( 'Enter the amount of points earned when a customer signs up for a newsletter via MailChimp.' ),
@seb86
seb86 / jquery-scroll-bottom.js
Created April 23, 2018 22:36 — forked from toshimaru/jquery-scroll-bottom.js
Detect the scrolling to bottom of the page using jQuery.
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});
@seb86
seb86 / Dynamic_Load_On_Scroll_Jquery.html
Created July 6, 2018 19:18 — forked from sphingu/Dynamic_Load_On_Scroll_Jquery.html
Loading content on scroll to bottom on page using Jquery
<html>
<head>
<title>Scroll to bottom Detection</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
var count=0;
$(document).ready(function(){
SetValues();
$(window).scroll(function(){
//Will check if the user has reached bottom of a PAGE
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
/* dragging logic for nomadlist.com/dating */
/* by @levelsio */
/* MIT license */
/* <dragging logic> */
$('body').on('mousedown touchstart','.card',function(e) {
if(!currentCardUserId) return;
if($('card.match_card').is(':visible')) return;
if(typeof e.originalEvent.touches !=='undefined') {
/* touch device */
@seb86
seb86 / woocommerce-notes-testing.php
Created September 7, 2020 14:10 — forked from octaedro/woocommerce-notes-testing.php
Adds 3 new notes with layout: banner, thumbnail, and plain, OR sets all the notes to not deleted.
<?php
/**
* Plugin Name: WooCommerce Prepare Notes Testing
* Plugin URI: https://woocommerce.com
* Description: Adds 3 new notes with layout: banner, thumbnail, and plain, OR sets all the notes to not deleted.
* Author: WooCommerce
* Domain Path: /test_notes
* Version: 0.1
*/
<?
# MIT license, do whatever you want with it
#
# This is my invoice.php page which I use to make invoices that customers want,
# with their address on it and which are easily printable. I love Stripe but
# their invoices and receipts were too wild for my customers on Remote OK
#
require_once(__DIR__.'/../vendor/autoload.php');
@seb86
seb86 / increase-variation-threshold.php
Created January 27, 2021 12:23 — forked from jessepearson/increase-variation-threshold.php
Increase the number of variations loaded in the WooCommerce front end for dynamic filtering of available variations in the drop down lists.
<?php //only copy this line if needed
/**
* Function filters the threshold for the amount of variables to load in the front end.
*
* @see https://woocommerce.wordpress.com/2015/07/13/improving-the-variations-interface-in-2-4/
* @param int $threshold Default of 30
* @return int 100 The new threshold.
*/
function lets_increase_the_variation_threshold( $threshold ) {