Skip to content

Instantly share code, notes, and snippets.

View thetwopct's full-sized avatar

James Hunt thetwopct

View GitHub Profile
@thetwopct
thetwopct / .gitignore
Last active April 11, 2024 04:07
Git Ignore (.gitignore) for WordPress development
## Config
movefile.yml
.lando.yml
## Development
build
vendor
node_modules
package-lock.json
debug.log
@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 / .htaccess
Created May 22, 2021 05:30
WordPress - Using .htaccess to load images from production server
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# If images not found on development site, load from production
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^wp-content/uploads/[^/]+/.+\.(jpe?g|jpg|png|gif)$ https://production.com/$0 [R=302,L]
@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 / bash.sh
Created January 20, 2020 15:56
Stop git branch opening in vim/vi
# stop git branch opening in vim/vi
git config --global pager.branch 'false'
@thetwopct
thetwopct / wp-cli-cheat-sheet.sh
Last active November 7, 2023 03:38
WordPress WP-CLI cheat sheet
# WordPress WP-CLI cheat sheet
# Reset everything in case of bugs
wp transient delete --all && wp rewrite flush && wp cache flush
# or in Lando
lando wp transient delete --all && lando wp rewrite flush && lando wp cache flush
# reset a new install
wp plugin delete $(wp plugin list --status=inactive --field=name)
wp theme delete $(wp theme list --status=inactive --field=name)
@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 / CPT-categories-loop.php
Last active October 20, 2023 09:21
Loop through CPT categories and display posts within
<?php
/*
* Loop through Categories and Display Posts within
https://wordimpress.com/loop-through-categories-and-display-posts-within/
*/
$post_type = 'treatments';
// Get all the taxonomies for this post type
@thetwopct
thetwopct / php-extensions.txt
Last active September 29, 2023 11:58
PHP 7.4 cPanel PHP Extension Settings
# PHP 7.4 cPanel PHP Extension Settings
dom
fileinfo
gd
imagick
intl
json
mbstring
mysqli