Skip to content

Instantly share code, notes, and snippets.

View webaware's full-sized avatar

Ross McKay webaware

View GitHub Profile
@webaware
webaware / gf-stripe-ignore-cc.php
Last active May 17, 2021 10:50
make GF Stripe add-on ignore credit card fields so that they can operate normally for other add-ons
<?php
/*
Plugin Name: GF Stripe Ignore CC Fields
Plugin URI: https://gist.github.com/webaware/0488a4bed8d16627af4de52092a356a6
Description: make GF Stripe add-on ignore credit card fields so that they can operate normally for other add-ons
Version: 1
Author: WebAware
Author URI: https://shop.webaware.com.au/
*/
@webaware
webaware / multisite-email-usernames.php
Last active March 31, 2021 09:22
WordPress plugin that allows users to register with email add username. NB: don't use when registering also creates a site, because it will get an invalid site name!
<?php
/*
Plugin Name: Multisite email usernames
Plugin URI: https://gist.github.com/webaware/9758737
Description: allow users to register on multisite with email address as user_name
Version: 3
Author: WebAware
Author URI: http://webaware.com.au/
*/
@webaware
webaware / gfeway-invoice-reference.php
Last active June 15, 2020 02:05
specify a custom Invoice Reference for Gravity Forms eWAY (Free and Pro) transactions. https://gfeway.webaware.net.au/
<?php
/*
Plugin Name: GFeWAY Invoice Reference
Plugin URI: https://gist.github.com/webaware/6f0fd469855e7c2d5b8495b9708c8003
Description: specify Invoice Reference for Gravity Forms eWAY transaction
Version: 1
Author: WebAware
Author URI: https://gfeway.webaware.net.au/
*/
@webaware
webaware / mininum_age_woo_checkout_hook.php
Created June 6, 2020 03:59
change position of the Minimim Age question on WooCommerce checkout, for the plugin Minimum Age for WooCommerce https://wordpress.org/plugins/minimum-age-woocommerce/
/**
* change position of Minimim Age question on WooCommerce checkout
* @param string $hook_name
* @return string
*/
add_filter('mininum_age_woo_checkout_hook', function($hook_name) {
return 'woocommerce_checkout_order_review';
});
@webaware
webaware / gf-country-as-code.php
Last active May 29, 2020 04:28
Save the country subfield of a Gravity Forms address as the country code.
<?php
/*
Plugin Name: GF Country as Code
Plugin URI: https://gist.github.com/webaware/c5b624416ad4a5641daab54ba9c91a0a
Description: save the country subfield of an address as the country code
Version: 1
Author: WebAware
Author URI: https://shop.webaware.com.au/
*/
@webaware
webaware / debug-log-not-strict.php
Last active May 28, 2020 08:01
Turn on WordPress' WP_DEBUG_LOG but without E_STRICT. Accompanying blog post: http://snippets.webaware.com.au/snippets/wordpress-wp_debug_log-without-e_strict/
<?php
/*
Plugin Name: Debug Log Not Strict
Plugin URI: https://gist.github.com/webaware/6520892
Description: Turn on WP_DEBUG_LOG but without E_STRICT
Version: 1.3.0
Author: WebAware
Author URI: https://shop.webaware.com.au/
*/
@webaware
webaware / flxmap-no-rocketscript.php
Last active January 31, 2020 16:29
stop CloudFlare Rockscript messing up WP Flexible Map plugin!
<?php
/*
Plugin Name: Flxmap No Rocketscript
Plugin URI: https://gist.github.com/webaware/8949605
Description: stop CloudFlare Rockscript messing up the map plugin!
Version: 3
Author: WebAware
Author URI: http://webaware.com.au/
@ref: http://wordpress.org/support/topic/map-wont-appear
@webaware
webaware / gist:3110728
Created July 14, 2012 11:25
basic example of populating a form from a database using AJAX and JSON
<?php
/*
-- the SQL database table
create table form_ajax (
ID varchar(5) not null,
Name varchar(100),
Address varchar(100),
Phone varchar(20),
Email varchar(255),
@webaware
webaware / Gruntfile.js
Created July 5, 2019 02:44
Our favicon / site tile cheat sheet for WordPress themes
// add task to Gruntfile.js
shell: {
// @link https://github.com/sindresorhus/grunt-shell
favicon: {
options: {
execOptions: {
cwd: "./images/favicons"
}
},
command: [
@webaware
webaware / gist:5349924
Last active May 10, 2019 21:25
Example of using the gform_pre_render filter hook to perform calculations, returning results in dynamically populated fields. See documentation links for more info. http://www.gravityhelp.com/documentation/page/Gform_pre_render http://www.gravityhelp.com/documentation/page/Using_Dynamic_Population
<?php
/**
* excerpt from compound classroom field, for example purposes only
* the real class is over 700 lines
*/
class OlpcGfClassroomField {
/**
* hook into Gravity Forms