Skip to content

Instantly share code, notes, and snippets.

View webaware's full-sized avatar

Ross McKay webaware

View GitHub Profile
@webaware
webaware / order-form-woo-sku.php
Last active August 29, 2015 14:20
Add product SKU underneath the product title on an order form from Order Form for WooCommerce. Requires version 1.0.5 or higher. Save this file as a simple plugin in the WordPress plugins folder. http://orderform-woo.webaware.net.au/
<?php
/*
Plugin Name: Order Form for WooCommerce SKU
Plugin URI: https://gist.github.com/webaware/7a8974a88caf4bcb3eed
Description: add product SKU to Order Form for WooCommerce product
Author: WebAware
Author URI: http://webaware.com.au/
*/
if (!defined('ABSPATH')) {
@webaware
webaware / order-form-woo-sku-column.php
Last active August 29, 2015 14:20
Add product SKU column before item (title) column on an order form from Order Form for WooCommerce. Requires version 1.4.0 or higher. Save this file as a simple plugin in the WordPress plugins folder. http://orderform-woo.webaware.net.au/
<?php
/*
Plugin Name: Order Form for WooCommerce SKU
Plugin URI: https://gist.github.com/webaware/a75e83ede1607536642b
Description: add product SKU column to Order Form for WooCommerce product
Author: WebAware
Author URI: http://webaware.com.au/
*/
if (!defined('ABSPATH')) {
@webaware
webaware / flxmap-ignore-bad-address.php
Last active August 29, 2015 14:26
ignore maps with invalid addresses in Flexible Map plugin -- http://flexible-map.webaware.net.au/
<?php
/*
Plugin Name: Flxmap Igore Bad Address
Plugin URI: https://gist.github.com/webaware/3ffe9c2bb9aeb0517714
Description: ignore maps with invalid addresses
Version: 1
Author: WebAware
Author URI: http://webaware.com.au/
*/
@webaware
webaware / gallery-download-all.php
Last active August 30, 2015 07:31
Strip away the thumbnails and just have a Download All button. [NextGEN Download Gallery](https://wordpress.org/plugins/nextgen-download-gallery/)
@webaware
webaware / gist:ebdb30dc33714f04e32b
Created February 24, 2015 09:57
Restore support for +/- quantity buttons in WooCommerce 2.3+
jQuery(function($) {
// Quantity buttons
$( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).addClass( 'buttons_added' ).append( '<input type="button" value="+" class="plus" />' ).prepend( '<input type="button" value="-" class="minus" />' );
$( document ).on( 'click', '.plus, .minus', function() {
// Get values
var $qty = $( this ).closest( '.quantity' ).find( '.qty' ),
@webaware
webaware / orderform-woo-extend-form.php
Last active September 27, 2015 19:59
Extend an Order Form for WooCommerce form with WordPress hooks, instead of hacking templates. Requires version 1.4.0 or higher. Save this file as a simple plugin in the WordPress plugins folder. http://orderform-woo.webaware.net.au/
<?php
/*
Plugin Name: Order Form for WooCommerce extend form
Plugin URI: https://gist.github.com/webaware/1fe598e60f9ad9a912ee
Description: example form extras using hooks
Author: WebAware
Author URI: http://webaware.com.au/
*/
@webaware
webaware / gist:2892517
Created June 8, 2012 00:05
When wp-e-commerce products are shown in an iframe, this will hopefully update the cart widget in the parent page
// example of JavaScript for somewhere on the page
<script>
function myReloadCart() {
form_values = "ajax=true&my_plugin_no_force_load=1"
jQuery.post( 'index.php?wpsc_ajax_action=get_cart', form_values, function(returned_data) {
eval(returned_data);
});
}
</script>
@webaware
webaware / gist:2999934
Created June 26, 2012 22:59
Using WordPress custom fields to drive WP Flexible Maps
<?php
/*
In reply to this request:
http://wordpress.org/support/topic/plugin-wp-flexible-map-updating-the-map-from-custom-field-data
add a simple [map] shortcode to WordPress that allows maps to be
created from custom fields:
"map zoom" = the zoom level (will default to 12 if not set)
@webaware
webaware / gist:3368517
Created August 16, 2012 08:55
kludge to make WordPress' Google Sitemap Generator exclude Page Links To pages linking to PDF files
<?php
function filterSitemapOptions($opts) {
global $wpdb;
// tell it to exclude any pages that are just page-links-to links to PDF files
$exclude = $wpdb->get_col("select post_id from $wpdb->postmeta where meta_key = '_links_to' and meta_value like '%.pdf'");
if (!empty($exclude)) {
$opts['sm_b_exclude'] = array_merge($opts['sm_b_exclude'], $exclude);
}
@webaware
webaware / gist:3808642
Created September 30, 2012 22:41
filter the eWAY invoice description for a Gravity Form post
<?php
/**
* filter the eWAY invoice description for a Gravity Form post
* @param string $desc the description before filtering
* @param array $form the Gravity Form object
* @return string
*/
function my_gfeway_invoice_desc($desc, $form) {
// set by form ID
switch ($form['id']) {