Skip to content

Instantly share code, notes, and snippets.

View seb86's full-sized avatar
🚀

Sébastien Dumont seb86

🚀
View GitHub Profile
@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 / wc-ajax-cart-check.php
Created April 6, 2017 22:48
Removes Ajax to run on the frontpage with WC to check if the cart has any items added. Saves about 2 seconds average of load time.
add_action( 'wp_enqueue_scripts', 'dequeue_woocommerce_cart_fragments', 11);
function dequeue_woocommerce_cart_fragments() {
if ( is_front_page() ) {
wp_dequeue_script('wc-cart-fragments');
}
}
@seb86
seb86 / .htaccess
Created April 19, 2017 14:39
Generic htaccess redirect www to non-www
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
@seb86
seb86 / .gitconfig
Created June 20, 2017 13:57
My Git Aliases
[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)"
@seb86
seb86 / setup-gitconfig.sh
Created June 20, 2017 14:45
Sets up your local repository .gitconfig file.
#!/bin/sh
set -e
git config --local include.path ../.gitconfig
echo "Your local .gitconfig is now setup!"
exit 1;
@seb86
seb86 / alnp-add-theme-support.php
Last active September 12, 2018 15:33
Declare support for Auto Load Next Post in a theme. Last two values are for Auto Load Next Post v1.5.0+ only!
/**
* 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 / 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 / content-alnp.php
Last active November 24, 2018 18:49
Auto Load Next Post template
<?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 / 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 / wpforms-gdpr-request-form.json
Created May 20, 2018 21:31
GDPR Data Request Form - Replace {{Company Name}} with the name of your company before importing into WPForms.
[{"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