Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Sébastien Dumont seb86

🏠
Working from home
View GitHub Profile
@seb86
seb86 / wcs-contract-subscription.php
Last active Apr 25, 2020
Disables certain action buttons for weekly subscriptions and subscriptions with a free trial. Weekly subscriptions can not be cancelled for at least a year.
View wcs-contract-subscription.php
<?php
/*
* Plugin Name: WooCommerce Subscriptions - Contract Subscriptions
* Description: Disables certain action buttons for weekly subscriptions and subscriptions with a free trial. Weekly subscriptions can not be cancelled for at least a year.
* Author: Sébastien Dumont
* Author URI: https://sebastiendumont.com
* Version: 0.0.2
*
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
@seb86
seb86 / alnp-filter-template-location.php
Created Jan 21, 2019
This filters the template location for Auto Load Next Post according to your themes template location.
View alnp-filter-template-location.php
<?php
function my_template_location() {
return 'templates/';
}
add_filter( 'alnp_template_location', 'my_template_location' );
@seb86
seb86 / Dynamic_Load_On_Scroll_Jquery.html
Created Jul 6, 2018 — forked from sphingu/Dynamic_Load_On_Scroll_Jquery.html
Loading content on scroll to bottom on page using Jquery
View Dynamic_Load_On_Scroll_Jquery.html
<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
@seb86
seb86 / wpforms-gdpr-request-form.json
Created May 20, 2018
GDPR Data Request Form - Replace {{Company Name}} with the name of your company before importing into WPForms.
View wpforms-gdpr-request-form.json
[{"id":"633128","field_id":"13","fields":{"3":{"id":"3","type":"select","label":"Are you a person or an organisation?","choices":{"1":{"default":"1","label":"I'm a Person","value":"","image":""},"2":{"label":"I'm Representing an Organisation","value":"","image":""}},"description":"","required":"1","size":"large","placeholder":"","css":"","dynamic_choices":""},"0":{"id":"0","type":"name","label":"What's your name?","format":"simple","description":"","required":"1","size":"large","simple_placeholder":"","simple_default":"","first_placeholder":"","first_default":"","middle_placeholder":"","middle_default":"","last_placeholder":"","last_default":"","css":""},"11":{"id":"11","type":"text","label":"What's your organisation's name?","description":"","required":"1","size":"medium","placeholder":"","default_value":"","css":"","input_mask":"","conditional_logic":"1","conditional_type":"show","conditionals":[[{"field":"3","operator":"==","value":"2"}]]},"12":{"id":"12","type":"text","label":"VAT number for your organisa
@seb86
seb86 / jquery-scroll-bottom.js
Created Apr 23, 2018 — forked from toshimaru/jquery-scroll-bottom.js
Detect the scrolling to bottom of the page using jQuery.
View jquery-scroll-bottom.js
$(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 / content-alnp.php
Last active Nov 24, 2018
Auto Load Next Post template
View content-alnp.php
<?php
/**
* The Template for displaying a post when called.
*
* This template can be overridden by copying it to yourtheme/auto-load-next-post/content-alnp.php.
*
* HOWEVER, on occasion Auto Load Next Post will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. I try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@seb86
seb86 / gist:a5446e0608e79e66b42b569cdcad9925
Created Aug 21, 2017 — forked from woogist/gist:5692886
Sample WooCommerce Points & Rewards 3rd Party Plugin Integration
View gist:a5446e0608e79e66b42b569cdcad9925
<?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 / alnp-add-theme-support.php
Last active Sep 12, 2018
Declare support for Auto Load Next Post in a theme. Last two values are for Auto Load Next Post v1.5.0+ only!
View alnp-add-theme-support.php
/**
* Add theme support for Auto Load Next Post by setting the
* theme selectors to be applied once the theme is activated.
*/
function add_alnp_theme_support() {
add_theme_support( 'auto-load-next-post', array(
'content_container' => 'main.site-main',
'title_selector' => 'h1.entry-title',
'navigation_container' => 'nav.post-navigation',
'comments_container' => 'div#comments',
@seb86
seb86 / setup-gitconfig.sh
Created Jun 20, 2017
Sets up your local repository .gitconfig file.
View setup-gitconfig.sh
#!/bin/sh
set -e
git config --local include.path ../.gitconfig
echo "Your local .gitconfig is now setup!"
exit 1;
@seb86
seb86 / .gitconfig
Created Jun 20, 2017
My Git Aliases
View .gitconfig
[alias]
# Creates a new branch on your local machine and switches into this branch.
newbie = "!git checkout -b $(git branch-name)"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
# Delete the remote version of the current branch
unpublish = "!git push origin :$(git branch-name)"