Skip to content

Instantly share code, notes, and snippets.

View davegreenwp's full-sized avatar
⌨️

Dave Green davegreenwp

⌨️
  • IconicWP (@iconicwp)
  • Manchester, UK
  • 18:07 (UTC +01:00)
View GitHub Profile
@davegreenwp
davegreenwp / class-wc-shipping-test-method.php
Last active April 30, 2023 11:11 — forked from mikejolley/gist:3b37b9cc19a774665f31
Example instance based shipping method
<?php
/**
* Example of a custom WC_Shipping_Method class.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
@eduwass
eduwass / docker-compose.yml
Last active December 31, 2023 00:31
Mailhog + WordPress in docker-compose.yml
version: '3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
@mikejolley
mikejolley / gist:3b37b9cc19a774665f31
Last active April 21, 2023 12:44
Example instance based shipping method
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Sample instance based method.
*/
class WC_Shipping_Test_Method extends WC_Shipping_Method {
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)