Skip to content

Instantly share code, notes, and snippets.

Avatar

Ross McKay webaware

View GitHub Profile
@webaware
webaware / plugin-template-functions.php
Created Feb 17, 2018
I have these functions in the plugin class that accesses templates, or break them out into simple functions if I'm using a namespace
View plugin-template-functions.php
<?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 Nov 27, 2017
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()`
View lurking-minicart-conditional.php
<?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 Jul 9, 2018
Stop Event Tickets from breaking WooCommerce product pages with an old select2 script
View event-tickets-woo-select2-fix.php
<?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 Jan 31, 2018
Stop NextGEN Gallery from breaking the Visual Editor in IE11 (which it does by switching it to IE10 emulation) Raw
View visual-editor-ngg-fix.php
<?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 Mar 2, 2017
Demonstrate a WooCommerce extension that doesn't catch the `woocommerce_loaded` hook because it fires before the extension had loaded
View yams-for-woocommerce.php
<?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 Sep 2, 2016
Temporary fix for WP eCommerce not reporting Payment Method in notification emails. See https://github.com/wp-e-commerce/WP-e-Commerce/issues/2152
View wpsc-fix-notification-payment-method.php
<?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 Sep 3, 2016
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/
View orderform-woo-cheque-only.php
<?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 Jun 15, 2020
specify a custom Invoice Reference for Gravity Forms eWAY (Free and Pro) transactions. https://gfeway.webaware.net.au/
View gfeway-invoice-reference.php
<?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
Redirect an Order Form for WooCommerce form to a custom URL on submit. https://orderform-woo.webaware.net.au/reference-manual/filter-hooks/
View order-form-woo-redirect.php
<?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
Detect coordinates given as address for Flexible Map shortcode, and copy it to the center attribute to avoid address lookups
View flxmap-coords-as-address.php
<?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/
*/