Skip to content

Instantly share code, notes, and snippets.

View webaware's full-sized avatar

Ross McKay webaware

View GitHub Profile
@webaware
webaware / flxmap-no-conflict.php
Last active March 30, 2018 13:52
attempt to revove extra Google Maps API scripts when showing a map from the Flexible Map plugin for WordPress
<?php
/*
Plugin Name: Flxmap No Conflict
Plugin URI: https://gist.github.com/webaware/3806a2dfdf2abcb61f64
Description: attempt to remove extra Google Maps API scripts when showing a Flexible Map
Version: 1
Author: WebAware
Author URI: http://webaware.com.au/
@link http://wordpress.org/support/topic/auto-route-and-direction-not-always-work
@webaware
webaware / htaccess-extras
Last active February 10, 2019 23:03
Here’s some basic recipe stuff to put into the top of .htaccess, above WP Super Cache and WordPress rules. Together, they reduce load on the server by compressing static files before sending them, making browsers cache static files, dying quickly on static files 404 errors, and blocking some common hacker / spammer attacks.
# v17 2019-01-11
# prevent listing files in folders
Options -Indexes
# some security rules
<IfModule mod_rewrite.c>
RewriteEngine On
# prevent php execution in uploads
RewriteRule /uploads/.*\.php - [F]
@webaware
webaware / flxmap-jquery-activate.php
Last active August 29, 2015 14:01
When you hide a Flexible Map in a tab or accordion, and then click on the tab to reveal its contents, the map doesn't know how big to draw until it is revealed. You need to give Google Maps a nudge so that it will pick up the correct size and position when you reveal it.
<?php
/*
Plugin Name: Flxmap jQuery UI Activate
Plugin URI: https://gist.github.com/webaware/05b27e3a99ccb00200f5
Description: Fix maps in jQuery UI hidden accordion and tab panels
Version: 2
Author: WebAware
Author URI: http://www.webaware.com.au/
*/
@webaware
webaware / gravity-forms-fields-above.php
Created May 12, 2014 03:39
Move Gravity Forms field labels from below to above fields in compound fields (e.g. Address, Name)
<?php
/*
Plugin Name: Gravity Forms Fields Above
Plugin URI: https://gist.github.com/webaware/24e1bacb47b76a6aee7f
Description: move field labels from below to above fields in compound fields (e.g. Address, Name)
Version: 1
Author: WebAware
Author URI: http://webaware.com.au/
@link http://www.gravityhelp.com/forums/topic/change-position-of-sub-labels-on-advanced-fields
@webaware
webaware / gist:d1b51f68977d32603491
Last active August 5, 2022 10:41
Clean up the mess left in WordPress users tables by WP e-Commerce, after you've removed that plugin from WordPress.
delete from u, um
using wp_users u
left join wp_usermeta um on um.user_id = u.ID
where u.user_login like '\_%'
@webaware
webaware / bitbucket.js
Created September 2, 2014 22:01
Some bookmarklets for setting tab-size to 4 on GitHub, Gist, and Bitbucket. NB: they all work in Chrome, but the GitHub and Gist ones don't work in Firefox (as at v31) because of its implementation for honouring CSP headers.
javascript:(function(){var style=document.createElement('style'),css=document.createTextNode('.refract-container .source{-moz-tab-size:4;tab-size:4;}');style.appendChild(css);document.getElementsByTagName('head')[0].appendChild(style);})();
@webaware
webaware / order-form-woo-attrs.php
Last active August 29, 2015 14:07
Add product attributes 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 Product Attributes
Plugin URI: https://gist.github.com/webaware/931c8c216a90a16b9c62
Description: add product attributes to Order Form for WooCommerce product
Author: WebAware
Author URI: http://webaware.com.au/
*/
if (!defined('ABSPATH')) {
@webaware
webaware / gist:5d1dc611437dc60f25fb
Last active August 29, 2015 14:10
Add product description underneath the product title on an order form from Order Form for WooCommerce. Requires version 1.0.5 or higher. http://orderform-woo.webaware.net.au/
<?php
/**
* add product description to Order Form for WooCommerce product
* @param WC_Product $product
* @param array $attrs
*/
add_action('orderform_woocommerce_order_item_end', function($product, $attrs) {
$description = $product->get_post_data()->post_content;
@webaware
webaware / gist:fbaf2227f551900d4509
Created December 22, 2014 01:51
Make sure that Gravity Forms PDF has a chance to run when Gravity Forms DPS PxPay processes transaction returns and confirmations
<?php
/**
* Include the Gravity Forms PDF Extended class if the GFDPSPXPAY plugin is listening to a return URL (IPN-style)
*/
function pdf_init_gfdpspxpay() {
if (class_exists('GFPDF_Core') && empty($GLOBALS['gfpdf'])) {
global $gfpdf;
$gfpdf = new GFPDF_Core();
}
@webaware
webaware / flxmap-custom-styling.php
Last active March 30, 2018 13:50
use Google Maps custom styling for the WordPress Flexible Map plugin -- see http://flexible-map.webaware.net.au/manual/styled-maps/
<?php
/*
Plugin Name: Flxmap custom styling
Plugin URI: https://gist.github.com/webaware/3808eb1cac17cb32a294
Description: use Google Maps custom styling for a map
Version: 1.0.1
Author: WebAware
Author URI: http://webaware.com.au/
*/