Skip to content

Instantly share code, notes, and snippets.

View thetwopct's full-sized avatar

James Hunt thetwopct

View GitHub Profile
@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 May 17, 2024 16:31
Lando example file for WordPress running node and npm inside Lando
name: basetheme
recipe: wordpress
config:
webroot: .
keys:
- id_rsa
excludes:
- vendor
- node_modules
services:
@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 November 3, 2024 16:20
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"
@thetwopct
thetwopct / component.php
Created November 3, 2021 05:54
Log variables/arrays in Laravel
<?php
use Illuminate\Support\Facades\Log;
class Component extends Model {
Log::info(print_r($variable, true));
}
@thetwopct
thetwopct / functions.php
Created September 8, 2021 15:41
Register an ACF Block (Gutenberg) with API v2 options
// register the dots background block.
acf_register_block_type(
array(
'name' => 'section-dots',
'title' => 'Section - Dots',
'description' => 'A full width section similar to group block to allow for dots background image.',
'render_template' => get_template_directory() . '/theme-parts/blocks/section-dots.php',
'enqueue_style' => get_template_directory() . '/theme-parts/blocks/section-dots.css',
'mode' => 'preview',
'icon' => 'format-aside',
@thetwopct
thetwopct / bash.sh
Last active September 1, 2021 05:50
Useful Docker Commands
# display the logs of a container
docker logs
# continue showing log updates
docker logs -f mycontainer
# lists the volumes
docker volume ls
# stops all running containers
@thetwopct
thetwopct / style.css
Created August 4, 2021 10:19
Hide the tick on WooCommerce Tax Toggle
/* Hides the tick on WooCommerce Tax Toggle */
#wcvat-toggle.on::before {
content: "";
background-image: url();
padding-left: 0;
background-size: 0;
}