Skip to content

Instantly share code, notes, and snippets.

View Luminus's full-sized avatar

Luminus Olumide Alabi Luminus

View GitHub Profile
@Luminus
Luminus / tatiana-mac-speaker-rider.md
Created August 3, 2019 09:21 — forked from tatianamac/tatiana-mac-speaker-rider.md
Tatiana Mac's Speaker Rider

Speaker Rider

by Tatiana Mac

Before I'll agree to a speaking event, I try to do as much research I can around the event to ensure it aligns with my ethos. I want to share this in case it's helpful to any other speakers.

👐 Speaking comes with immense privilege. I am grateful to all the conference organisers who have brilliantly hosted me. I would love to continue to exercise this privilege to speak at conferences, and use this privilege to make the landscape more accessible and beneficial to tech's most marginalised and suppressed communities.

😫 I wish I didn't have to, but this is long because I provide a lot of explanations for those of you who never had to consider these things. And I will be honest, most thoughtful conferences I've attended check most of these boxes intrinsically, particularly when conference runners are experienced speakers. They get it.

1️⃣ All of these are based on my own ethos. I don't wish to or attempt to speak on behalf of all conference speake

@Luminus
Luminus / functions.php
Created March 7, 2018 14:11
Change Arab Emirates Dirhams currency display in WooCommerce from Arabic script to AED
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);
function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'AED': $currency_symbol = 'AED'; break;
}
return $currency_symbol;
}
@Luminus
Luminus / config.yml
Created February 19, 2018 14:21
My `~/.wp-cli/config.yml` file for bending WP-CLI and the WP-CLI Valet Command to my will
core config:
dbuser: root
dbpass: root
extra-php: |
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);
define( 'WCS_DEBUG', true );
@Luminus
Luminus / wp-clone
Last active December 7, 2018 11:19
Clone an existing local WordPress site to a new folder. You must be using Laravel Valet or Valet+ as your local development environment
#!/bin/bash
# Function to display usage instructions when the command is used incorrectly
function usage {
echo "usage: wp-clone <source> <destination>"
echo "<source> is the site you want to clone"
echo "<destination> is where you want to clone it to"
exit 1
}
@Luminus
Luminus / wc-site
Last active January 9, 2019 07:44
Setup a new WordPress site with WooCommerce and Storefront installed and activated. You must have Laravel Valet or Valet+ installed and also the WP CLI Valet Command - https://aaemnnost.tv/wp-cli-commands/valet/ and the WP-CLI Login Command - https:/
#!/bin/bash
# Function to display usage instructions when the command is used incorrectly
function usage {
echo "usage: wc-site <name> [--master]"
echo "e.g. wc-site gradient will create a site at https://gradient.test"
echo "The \"--master\" switch will install the current WooCommerce master from Github"
exit 1
}
@Luminus
Luminus / functions.php
Last active December 20, 2017 09:30
Automatically restore WooCommerce Stock when you cancel an order
class Luminus_Woocommerce_Auto_Stock_Restore {
function __construct() {
add_action( 'woocommerce_order_status_processing_to_cancelled', array( $this, 'restore_order_stock' ), 10, 1 );
add_action( 'woocommerce_order_status_completed_to_cancelled', array( $this, 'restore_order_stock' ), 10, 1 );
add_action( 'woocommerce_order_status_on-hold_to_cancelled', array( $this, 'restore_order_stock' ), 10, 1 );
// add_action( 'woocommerce_order_status_processing_to_refunded', array( $this, 'restore_order_stock' ), 10, 1 );
// add_action( 'woocommerce_order_status_completed_to_refunded', array( $this, 'restore_order_stock' ), 10, 1 );
// add_action( 'woocommerce_order_status_on-hold_to_refunded', array( $this, 'restore_order_stock' ), 10, 1 );
}
@Luminus
Luminus / functions.php
Created December 6, 2017 09:40
Disable specific payment gateways on a specific language version of your WooCommerce site that's running WPML
<?php
function wpml_filter_gateways($gateways){
if(ICL_LANGUAGE_CODE == 'fr') //Checks if the selected language is French.
unset($gateways['paypal']); //"remove" paypal
return $gateways; //returns the other payment methods.
}
add_filter('woocommerce_available_payment_gateways','wpml_filter_gateways',1);
@Luminus
Luminus / functions.php
Created December 5, 2017 05:36
Remove Related Products from the Single Product Page for Products in a Specific Category
<?php
add_action( 'wp', 'vn_remove_related_products' );
function vn_remove_related_products() {
// replace 'accessories' with the slug for your product category
if ( is_product() && has_term( 'accessories', 'product_cat' ) ) {
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
}
}
@Luminus
Luminus / functions.php
Created November 20, 2017 06:27
Hide Coupon Form from the Cart & Checkout Pages if there's a Deposit Product in the Cart
<?php
// hide coupon form from the cart and checkout pages if there's a deposit product in the cart
function hide_coupon_field( $enabled ) {
if ( is_cart() || is_checkout() ) {
if ( class_exists( 'WC_Deposits_Cart_Manager' ) ) {
if ( WC_Deposits_Cart_Manager::has_deposit() ) {
$enabled = false;
}
}
@Luminus
Luminus / functions.php
Last active July 26, 2019 22:40
Display the "Sold By: Vendor Name" of Product Vendors under the product name on single product page & Hide the original one
<?php
if ( class_exists( 'WC_Product_Vendors_Vendor_Frontend' ) ) {
add_action( 'woocommerce_single_product_summary', array( WC_Product_Vendors_Vendor_Frontend, 'add_sold_by_single' ), 5 );
}