Skip to content

Instantly share code, notes, and snippets.

View thetwopct's full-sized avatar

James Hunt thetwopct

View GitHub Profile
@thetwopct
thetwopct / functions.php
Last active January 8, 2023 05:43
Customisation of Tax Toggle for WooCommerce for compatibility with 99w Rentals Plugin
<?php
/**
* Customisation of Tax Toggle for WooCommerce for compatibility with 99w Rentals Plugin
*
* Based on Tax Toggle for WooCommerce 1.3.6
*
* Plugin: https://1.envato.market/taxtoggle
*
* @param string $price_display_override Rental price.
@thetwopct
thetwopct / functions.php
Last active January 8, 2023 05:40
Tax Toggle for WooCommerce - How to show From X to X price label on variable products
<?php
/**
* Customisation of Tax Toggle for WooCommerce to show From X to X price label on variable products.
*
* Based on Tax Toggle for WooCommerce 1.3.6
*
* Plugin: https://1.envato.market/taxtoggle
*
* @param string $price Price.
* @param object $product Product.
@thetwopct
thetwopct / tax-toggle-text.js
Last active March 15, 2023 16:32
Tax Toggle change text of button on click
/**
* Custom code for Tax Toggle for WooCommerce - Changes text of button on click
*
* Based on Tax Toggle for WooCommerce 1.3.6
*
* Plugin: https://1.envato.market/taxtoggle
*
**/
@thetwopct
thetwopct / functions.php
Last active January 8, 2023 05:41
Deactivate Tax Toggle on some pages / meeting conditions.
<?php
/**
* Remove Tax inc/exc toggle code on some pages.
*
* Based on Tax Toggle for WooCommerce 1.3.6
*
* Plugin: https://1.envato.market/taxtoggle
*/
function woo_tax_toggle_remove_tax_on_some_pages(){
@thetwopct
thetwopct / privacy-policy.html
Created August 7, 2022 14:44
Generic Privacy Policy for pasting in to WordPress Block Editor Gutenberg (Not legal advice)
<!-- wp:paragraph -->
<p>This page contains all our legal statements.</p>
<!-- /wp:paragraph -->
<!-- wp:heading -->
<h2>Privacy Policy </h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>This privacy notice was last updated on:  XXXX DATE </p>
@thetwopct
thetwopct / single-product.js
Created June 13, 2022 17:43
Add content before and after thumbnail images in WooCommerce product thumbnails
jQuery( document ).ready(
function( $ ) {
var newDiv = document.createElement('div');
$(newDiv).attr('id','slider-nav');
$(newDiv).attr('class','slider-nav');
$('.flex-control-nav').wrap('#slider-nav');
$('.flex-control-nav').wrap(newDiv);
$('.flex-control-nav').before('<span class="chevron-up"></span>');
$('.flex-control-nav').after('<span class="chevron-down"></span>');
}
@thetwopct
thetwopct / .lando.yml
Last active June 9, 2022 08:53
Lando example file for WordPress running node and npm inside Lando
name: basetheme
recipe: wordpress
config:
webroot: .
keys:
- id_rsa
proxy:
node:
- bs.basetheme.lndo.site:3000
excludes:
@thetwopct
thetwopct / custom-tax-toggle.css
Last active January 7, 2023 10:29
Toggle example
#wcvat-toggle {
margin: 0 4rem;
padding: 0;
position: relative;
border: none;
height: 1.5rem;
width: 3rem;
border-radius: 1.5rem;
color: #6b7381;
@thetwopct
thetwopct / wp-env-cheat-sheet.sh
Last active February 15, 2022 06:37
wp-env Cheat Sheet
# start from your package.json
npm run wp-env start
# default address
http://localhost:8888
# default credentials
username: admin
password: password
@thetwopct
thetwopct / bash.sh
Created December 30, 2021 04:04
Decrypt a PDF and remove password
# install qpdf
brew install qpdf
# run in the directory
qpdf --decrypt --password="password" "original.pdf" "new.pdf"