Skip to content

Instantly share code, notes, and snippets.

View thetwopct's full-sized avatar

James Hunt thetwopct

View GitHub Profile
@thetwopct
thetwopct / .lando.yml
Created June 25, 2024 08:30
Getting SymLink working in Lando (WordPress Theme Example)
# the first path should be pointing to your theme or plugin
# the second path is the directory where your theme or plugin needs to go inside Lando (starts with /app/)
services:
appserver:
overrides:
volumes:
- ~/Sites/my-theme:/app/wp-content/themes/my-theme
@thetwopct
thetwopct / deployment.sh
Created June 24, 2024 08:04
Laravel Forge Deployment Script
cd $FORGE_SITE_PATH
pwd
php artisan down || true
echo "git fetch"
git fetch origin
echo "git checkout"
@thetwopct
thetwopct / bash.sh
Created June 12, 2024 11:07
Using Laravel (11 or any version) on cPanel/WHM when public_html default directory cannot be changed
# Using Laravel (11 or any version) on cPanel/WHM when public_html default directory cannot be changed
# open terminal, go to the root of your folder where /public_html is visible, delete the existing public_html
rm -rf public_html
# create a directory call app where your app will go
mkdir app
# create symlink from public_html to app/public
ln -s /app/public public_html
@thetwopct
thetwopct / console.js
Created June 7, 2024 09:04
WP All-in-one Migration plugin - restore a backup bypass code
# Upload your .wpress file to ai1wm-backups and make a note of the name
# Go to the WP All-in-One Migration plugin > Backups
# Open the console in the browser
var filename = 'YOUR-FILE.wpress';
var importer = new Ai1wm.Import();
var storage = Ai1wm.Util.random(12);
var options = Ai1wm.Util.form('#ai1wm-backups-form').concat({name: 'storage', value: storage}).concat({name: 'archive', value: filename});
importer.setParams(options);
importer.start();
@thetwopct
thetwopct / .htaccess
Created May 19, 2024 05:38
Changing upload limit for importing in to WP All-in-One Migration
# from https://www.thetwopercent.co.uk/changing-upload-limit-for-wp-aio-migration/
php_value upload_max_filesize 512M
php_value post_max_size 512M
php_value max_execution_time 300
php_value max_input_time 300
@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