Skip to content

Instantly share code, notes, and snippets.

View webaware's full-sized avatar

Ross McKay webaware

View GitHub Profile
@webaware
webaware / plugin-template-functions.php
Created February 17, 2018 02:21
I have these functions in the plugin class that accesses templates, or break them out into simple functions if I'm using a namespace
<?php
/**
* load template from theme or plugin
* @param string $template name of template to load
* @param array $templateData data to make available to templates
*/
public function loadTemplate($template, $templateData = []) {
extract($templateData);
@webaware
webaware / lurking-minicart-conditional.php
Last active November 27, 2017 16:50
Only show the Lurking Minicart when required. This code tests for WooCommerce shop, product, and product taxonomy pages (categories/tags/etc.) but you can also test for individual pages with `is_page()`
<?php
/*
Plugin Name: Lurking Minicart Conditional Display
Plugin URI: https://gist.github.com/webaware/2210f8a70fc4ee3bfd13eb22c3d32ebd
Description: Only show the Lurking Minicart when required
Author: WebAware
Author URI: https://lurking-minicart.webaware.net.au/
*/
if (!defined('ABSPATH')) {
@webaware
webaware / event-tickets-woo-select2-fix.php
Last active July 9, 2018 07:52
Stop Event Tickets from breaking WooCommerce product pages with an old select2 script
<?php
/*
Plugin Name: Fix Events vs WooCommerce select2
Plugin URI: https://gist.github.com/webaware/f7c8ba642b7a12a1ea8c74277e5af084
Description: Stop Event Tickets and The Events Calendar from breaking WooCommerce product pages with an old select2 script
Version: 1.2
Author: WebAware
Author URI: https://shop.webaware.com.au/
*/
@webaware
webaware / visual-editor-ngg-fix.php
Last active January 31, 2018 17:17
Stop NextGEN Gallery from breaking the Visual Editor in IE11 (which it does by switching it to IE10 emulation) Raw
<?php
/*
Plugin Name: Visual Editor Fix for NGG
Plugin URI: https://gist.github.com/webaware/66abf3366aae6f86db8770c4ec7ddd16
Description: Stop NextGEN Gallery from breaking the Visual Editor in IE11
Version: 1
Author: WebAware
Author URI: https://shop.webaware.com.au/
*/
@webaware
webaware / yams-for-woocommerce.php
Created March 2, 2017 21:06
Demonstrate a WooCommerce extension that doesn't catch the `woocommerce_loaded` hook because it fires before the extension had loaded
<?php
/*
Plugin Name: Yams for Woo
Description: A plugin that loads after WooCommerce, so it misses the woocommerce_loaded action
Version: 1
Author: WebAware
Author URI: https://shop.webaware.com.au/
*/
error_log(basename(__FILE__));
@webaware
webaware / wpsc-fix-notification-payment-method.php
Created September 2, 2016 03:34
Temporary fix for WP eCommerce not reporting Payment Method in notification emails. See https://github.com/wp-e-commerce/WP-e-Commerce/issues/2152
<?php
/*
Plugin Name: WP eCommerce Payment Method notifications fix
Plugin URI: https://gist.github.com/webaware/4635d476e506c95c26c66a121631a7dc
Description: temporary fix for WP eCommerce not reporting Payment Method in notification emails
Author: WebAware
Author URI: https://shop.webaware.com.au/
*/
if (!defined('ABSPATH')) {
@webaware
webaware / orderform-woo-cheque-only.php
Last active September 3, 2016 02:52
Restrict payment gateways for Order Form for WooCommerce orders to the Cheque payment gateway. Available since version 1.8.0. https://orderform-woo.webaware.net.au/
<?php
/*
Plugin Name: Order Form for WooCommerce Cheque Only
Plugin URI: https://gist.github.com/webaware/54b8e8a951224c3bef55464632dfd139
Description: Only allow the Cheque payment gateway for order form purchases
Author: WebAware
Author URI: https://orderform-woo.webaware.net.au/
*/
if (!defined('ABSPATH')) {
@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 / order-form-woo-redirect.php
Created May 26, 2016 22:54
Redirect an Order Form for WooCommerce form to a custom URL on submit. https://orderform-woo.webaware.net.au/reference-manual/filter-hooks/
<?php
/*
Plugin Name: Order Form for WooCommerce Redirect
Plugin URI: https://gist.github.com/webaware/e2817c2fcdd8d3cb4ee498d75d27ebb9
Description: redirect order form to specific page when submitted
Author: WebAware
Author URI: http://webaware.com.au/
@link https://orderform-woo.webaware.net.au/reference-manual/filter-hooks/#orderform_woocommerce_form_redirect
*/
@webaware
webaware / flxmap-coords-as-address.php
Created May 19, 2016 22:36
Detect coordinates given as address for Flexible Map shortcode, and copy it to the center attribute to avoid address lookups
<?php
/*
Plugin Name: Flxmap Coordinates as Address
Plugin URI: https://gist.github.com/webaware/610810443c96f601960bb59659ac9958
Description: detect coordinates given as address and fix the map attribute
Version: 1
Author: WebAware
Author URI: http://webaware.com.au/
*/