Skip to content

Instantly share code, notes, and snippets.

View benhuson's full-sized avatar

Ben Huson benhuson

View GitHub Profile
@benhuson
benhuson / users2csv.php.patch
Last active December 31, 2015 20:39
Patch for Users 2 CSV WordPress plugin.
Index: users2csv.php
===================================================================
--- users2csv.php (revision 277117)
+++ users2csv.php (working copy)
@@ -26,7 +26,7 @@
if ( is_admin() ) {
- if ($_GET['page'] == "users2csv.php") {
+ if ( isset( $_GET['page'] ) && $_GET['page'] == 'users2csv.php' ) {
@benhuson
benhuson / ios7-safari-height-issue
Last active April 22, 2016 10:10
Fix iOS 7 iPad Safari Landscape innerHeight/outerHeight layout issue
/**
* Add ipad IOS7 Classes
* Allows us to temporariliy try to fix the slight scroll 100% hack.
* http://stackoverflow.com/questions/19012135/ios-7-ipad-safari-landscape-innerheight-outerheight-layout-issue
*/
if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) {
$('html').addClass('ipad ios7');
}
/**
@benhuson
benhuson / .htaccess
Last active September 9, 2015 15:52
.htaccess examples
# Redirect to fully qualified domain if different
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com
RewriteRule (.*) http://www.example.com%{REQUEST_URI}
</IfModule>
@benhuson
benhuson / wp-config.php
Created April 1, 2014 16:49
Sample snippets for wp-config.php
<?php
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define( 'WP_DEBUG', true );
/* Nested Ordered List */
ol {
counter-reset: ol
}
li {
display: block
}
@benhuson
benhuson / my_plugin_row_meta.php
Created May 1, 2014 17:24
Add a link to your GitHub repo and translation link to your WordPress plugin.
<?php
/**
* Plugin Row Meta
*
* Adds GitHub and translate links below the plugin description on the plugins page.
* Replace references to 'my-plugin' to reflect your plugin folder and file name.
* Update the GitHub Repo and Translation links.
*
* @param array $plugin_meta Plugin meta display array.
@benhuson
benhuson / list-pages-shortcode-index.php
Last active August 29, 2015 14:04
List Pages Shortcode Index - Create alphabetically indexes using the List Pages Shortcode plugin (http://wordpress.org/extend/plugins/list-pages-shortcode/)
<?php
/*
Plugin Name: List Pages Shortcode Index
Plugin URI: https://gist.github.com/benhuson/9c419282d8e05fff6eeb
Description: Add-on for the <a href="https://wordpress.org/plugins/list-pages-shortcode/">List Pages Shortcode</a> plugin.
Author: Ben Huson
Version: 0.1
Author URI: https://github.com/benhuson
*/
@benhuson
benhuson / WordPress-jQuery
Created October 9, 2014 08:53
WordPress jQuery Tips
/**
* jQuery Wrapper
*/
( function( $ ) {
// Safe to use $
} )( jQuery );
@benhuson
benhuson / cust-vimeo-oembed
Last active April 18, 2020 23:30
Customise WordPress Vimeo oEmbed
<?php
/**
* Customise WordPress Vimeo oEmbed
* https://developer.vimeo.com/apis/oembed
*/
function my_oembed_fetch_url( $provider, $url, $args ) {
if ( strpos( $provider, 'vimeo.com' ) !== false) {
{
"url": "http://example.com/json",
"rates": [
{
"name": "Belgium",
"code": "BE",
"periods": [
{
"effective_from": "1996-01-01",
"rates": {