This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove woocommerce and woo-subscriptions delete actions. | |
* @return [type] [description] | |
*/ | |
function mts_remove_delete_actions() { | |
remove_action( 'delete_user', 'WC_Subscriptions_Manager::trash_users_subscriptions' ); | |
remove_action( 'deleted_user', 'wc_reset_order_customer_id_on_deleted_user' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add $number param to woocommerce-subscriptions. | |
* | |
* @param int (optional) An interval in the range 1-6 | |
* @param string (optional) One of day, week, month or year. If empty, all subscription ranges are returned. | |
* @since 2.0 | |
*/ | |
function wcs_get_subscription_period_strings( $number = 1, $period = '' ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Make sure WooCommerce is active | |
if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) return; | |
//Adds Child Gateway Class | |
add_action( 'plugins_loaded', 'init_call_for_payment_info' ); | |
function init_call_for_payment_info() { | |
class WC_Gateway_Call_for_Payment_Info extends WC_Payment_Gateway { | |
//Construct Gateway |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
acl from_cf src -f /etc/haproxy/cf-ips | |
http-request set-src req.hdr(CF-Connecting-IP) if from_cf | |
option forwardfor if-none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WordPress single site rules. | |
# Designed to be included in any server {} block. | |
# This order might seem weird - this is attempted to match last if rules below fail. | |
# http://wiki.nginx.org/HttpCoreModule | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} | |
# Add trailing slash to */wp-admin requests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# wp-secure.conf | |
# | |
# | |
# This file includes common security considerations for wordpress using nginx. | |
# | |
# The goal is to block actions which are usually dangerous to wordpress. | |
# Additionally, we block direct access to PHP files and folders which should not | |
# be accessed directly from a browser. | |
# | |
# Also have included exceptions for plugins that are known to require this access. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std; | |
acl whitelist { | |
"123.123.123.123"; | |
"216.3.128.12"; | |
} | |
sub vcl_recv { | |
# If not a whitelisted IP, then display maintenance page. Requires std library. | |
if(std.ip(regsub(req.http.X-Forwarded-For, "[, ].*$", ""), client.ip) !~ whitelist) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Variable subscription product add to cart | |
* | |
* @author Prospress | |
* @package WooCommerce-Subscriptions/Templates | |
* @version 2.0.9 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/woothemes/woocommerce/issues/3641 | |
// http://stackoverflow.com/questions/36300773/woocommerce-programmatically-changing-the-default-shipping-method | |
// guts of function straight copy of function get_default_method from WC v. 2.5.5 includes/class-wc-shipping.php | |
function plx_default_cheapest_shipping_method( $current_chosen_method, $available_methods ) { | |
$selection_priority = get_option( 'woocommerce_shipping_method_selection_priority', array() ); | |
if ( ! empty( $available_methods ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Display variations dropdowns on shop page for variable products | |
add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' ); | |
function woo_display_variation_dropdown_on_shop_page() { | |
global $product; | |
if( $product->is_type( 'variable' )) { | |
NewerOlder