Skip to content

Instantly share code, notes, and snippets.

View mommaroodles's full-sized avatar

Melanie Shepherd mommaroodles

View GitHub Profile
@mommaroodles
mommaroodles / expect-header-fix.php
Created March 11, 2021 04:04 — forked from carlalexander/expect-header-fix.php
WordPress "Expect" header fix
<?php
/**
* By default, cURL sends the "Expect" header all the time which severely impacts
* performance. Instead, we'll send it if the body is larger than 1 mb like
* Guzzle does.
*/
function add_expect_header(array $arguments)
{
$arguments['headers']['expect'] = !empty($arguments['body']) && strlen($arguments['body']) > 1048576 ? '100-Continue' : '';
@mommaroodles
mommaroodles / 1-remove-woocommerce-tabs.php
Created May 28, 2019 23:59 — forked from kittenlane/1-remove-woocommerce-tabs.php
Remove tabs but keep product description in WooCommerce
//* http://gasolicious.com/remove-tabs-keep-product-description-woocommerce/
// Location: add to functions.php
// Output: removes woocommerce tabs
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
@mommaroodles
mommaroodles / WooCommerce: Saved on Discount Amount and Percentage for Simple Products
Created May 23, 2019 16:56
WooCommerce: Saved on Discount Amount and Percentage for Simple Products
add_filter( 'woocommerce_get_price_html', 'bdev_display_sale_price_and_percentage_html', 10, 2 );
function bdev_display_sale_price_and_percentage_html( $price, $product ) {
// sale products on frontend excluding variable products
if( $product->is_on_sale() && ! is_admin() && $product->is_type('simple')) {
// product prices
$regular_price = (float) $product->get_regular_price();
$sale_price = (float) $product->get_price();
@mommaroodles
mommaroodles / functions.php
Created May 17, 2019 11:27 — forked from sharkyak/functions.php
woocommerce remove add to cart button
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );
remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 );
@mommaroodles
mommaroodles / functions.php
Created May 17, 2019 11:25 — forked from BFTrick/functions.php
Remove Add to Cart Buttons
<?php
function patricks_remove_loop_button(){
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); // removes the add to cart button on the shop page
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); //removes the add to cart button on the single product page
}
add_action('init','patricks_remove_loop_button');
@mommaroodles
mommaroodles / functions.php
Created May 17, 2019 11:21 — forked from chrdesigner/functions.php
Custom Add To Cart Messages
<?php
add_filter( 'wc_add_to_cart_message', 'custom_add_to_cart_message' );
function custom_add_to_cart_message( $product_id ) {
$product_id = $_REQUEST[ 'product_id' ];
if ( is_array( $product_id ) ) {
$titles = array();
// Change add to cart text on archives depending on product type
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' );
function custom_woocommerce_product_add_to_cart_text() {
global $product;
$product_type = $product->product_type;
switch ( $product_type ) {
case 'external':
return __( 'Take me to their site!', 'woocommerce' );
@mommaroodles
mommaroodles / woocommerce-single-product-functions.php
Created May 17, 2019 11:05 — forked from ohsoren/woocommerce-single-product-functions.php
Reorder the single product page product information
<?php
/**
* woocommerce_single_product_summary hook
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
@mommaroodles
mommaroodles / functions.php
Created May 17, 2019 11:03 — forked from ChromeOrange/functions.php
Managing WooCommerce Product Tabs
<?php
/**
* Standard Tab Code from woocommerce-hooks.php
*/
/* Product page tabs */
add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 );
add_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 );
add_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 );
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 10 );
@mommaroodles
mommaroodles / docker-swarm-ports.md
Created April 27, 2019 10:50 — forked from BretFisher/docker-swarm-ports.md
Docker Swarm Port Requirements, both Swarm Mode 1.12+ and Swarm Classic, plus AWS Security Group Style Tables

Docker Swarm Mode Ports

Starting with 1.12 in July 2016, Docker Swarm Mode is a built-in solution with built-in key/value store. Easier to get started, and fewer ports to configure.

Inbound Traffic for Swarm Management

  • TCP port 2377 for cluster management & raft sync communications
  • TCP and UDP port 7946 for "control plane" gossip discovery communication between all nodes
  • UDP port 4789 for "data plane" VXLAN overlay network traffic
  • IP Protocol 50 (ESP) if you plan on using overlay network with the encryption option

AWS Security Group Example