Skip to content

Instantly share code, notes, and snippets.

View thetwopct's full-sized avatar

James Hunt thetwopct

View GitHub Profile
@thetwopct
thetwopct / wp-config.php
Created April 11, 2024 03:43
wp-config.php constants to stop new WordPress themes, stop Theme and Plugin Editing (version control/Git)
// Disable Theme and Plugin Editor
define('DISALLOW_FILE_EDIT', true);
// Stop new themes being installed automatically i.e. twentytwentyfour
define('CORE_UPGRADE_SKIP_NEW_BUNDLED', true);
// Disable core, plugins and theme updates (only update via version control)
define('DISALLOW_FILE_MODS', true);
@thetwopct
thetwopct / laravel-shopify-api-packages.txt
Last active April 8, 2024 03:31
Laravel + Shopify API Packages (Maintained List)
https://github.com/Kyon147/laravel-shopify
Last Release - 1st April 2024
Designed to create a public facing app
https://github.com/Shopify/shopify-api-php
v5.3.0 - Released Jan 11 2024
Not a Laravel Package, just basic PHP starter
https://github.com/phpclassic/php-shopify
Last Release - Sept 25, 2023
@thetwopct
thetwopct / module.html
Created January 14, 2024 10:31
HubL - Get multiple blogs, display together, order by published date
{# Create a variable to collect all posts #}
{% set all_posts = [] %}
{# Loop through all posts selected in the blog field #}
{% for item in module.blogs.selected %}
{# Get posts for each blog #}
{% set posts = blog_recent_posts(item, 200) %}
{# Append each post to the all_posts array #}
@thetwopct
thetwopct / cli.sh
Created October 21, 2023 14:22
WP-CLI command to fix the “Another Update is Currently in Progress” Error in WordPress
# this looks for an option called core_updater.lock and deletes it.
wp option delete core_updater.lock
# then update...
wp core update
@thetwopct
thetwopct / woocommerce-sample-data.sh
Created February 22, 2023 14:36
Import WooCommerce Sample Data
# Install Importer
wp plugin install wordpress-importer --activate
# download the sample data
wget https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/plugins/woocommerce/sample-data/sample_products.xml
# import the data
wp import sample_products.xml --authors=create
@thetwopct
thetwopct / Toggle (Inspired by Apple) for Tax Toggle for WooCommerce
Created February 21, 2023 08:08
iOS-style Toggle for Tax Toggle for WooCommerce
This is a modification for Tax Toggle for WooCommerce (see https://www.taxtoggle.com?ref=gist)
It creates a iOS-style "toggle" button which can be inserted in your theme showing status of the tax toggle - either inclusive or exclusive or any other wording you wish to use.
How to use:
1. Go to WP Admin > WooCommerce > Settings > Tax and turn off the floating tax toggle.
2. Add the custom CSS to your theme.
3. Add the custom Tax Toggle to your theme (i.e. in the header.php file). You can change the wording (Excludes Tax / Includes Tax) to anything you want to describe the on/off tax function.
4. You can customise the toggle formatting with the simple CSS variables specified.
@thetwopct
thetwopct / wordpress-test-data-import.sh
Last active February 22, 2023 14:08
Import Theme Unit Test Data in to WordPress
#!/usr/bin/env bash
set -e
# Activate WP Importer plugin.
wp plugin install wordpress-importer --activate
# Don't know why, but failed importing directly.
wget https://raw.githubusercontent.com/WPTRT/theme-unit-test/master/themeunittestdata.wordpress.xml
# Import
wp import themeunittestdata.wordpress.xml --authors=create
@thetwopct
thetwopct / .wp-env.json
Created February 17, 2023 04:14
Theme Review wordpress@env setup
{
"$schema": "https://raw.githubusercontent.com/WordPress/gutenberg/17c1465fa82a325b5e99a8a010e63b72c5c612e9/schemas/json/.wp-env.json",
"core": null,
"plugins": [
"https://github.com/WPTT/theme-sniffer/releases/download/1.1.2/theme-sniffer.zip",
"https://downloads.wordpress.org/plugin/query-monitor.zip",
"https://downloads.wordpress.org/plugin/log-deprecated-notices.zip",
"https://downloads.wordpress.org/plugin/theme-check.zip"
],
"themes": [
@thetwopct
thetwopct / myphpcs
Created January 19, 2023 08:39
squizlabs / PHP_CodeSniffer (phpcs) inside Docker in VS Code
#!/usr/bin/env bash
# Place this file in your Docker apps vendor/bin.
# Use VS Code plugin - PHP Sniffer & Beautifier by Samuel Hilson
# Set executablePath for PHPCS to be ./vendor/bin/myphpcs
# If you also want PHPCBF, duplicate this file, change any references of phpcs to phpcbf and add the CBF executable path.
set -eo pipefail
main_exec() {
@thetwopct
thetwopct / Simple on and off inline button for Tax Toggle.md
Last active January 14, 2023 08:40
Simple on and off inline button for Tax Toggle for WooCommerce

This is a modification for Tax Toggle for WooCommerce (see https://www.taxtoggle.com?ref=gist)

It creates a simple inline button in your theme showing status of the tax toggle - either inclusive or exclusive.

How to use:

  1. Go to WP Admin > WooCommerce > Settings > Tax and turn off the floating tax toggle.
  2. Add the custom CSS to your theme
  3. Add the custom Tax Toggle to your theme (i.e. in the header.php file). You can change the wording (Excludes Tax / Includes Tax) to anything you want to describe the on/off tax function.