Skip to content

Instantly share code, notes, and snippets.

Gary Jones GaryJones

Block or report user

Report or block GaryJones

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View superfish-1.7.4-1.7.10.diff
--- /var/folders/5h/n5kgg5w13h77n1ffpd4hm2800000gn/T/rPo5nh_superfish.js 2018-10-05 10:50:58.000000000 +0100
+++ /Users/gary/Local Sites/genesis/app/public/wp-content/themes/genesis/lib/js/menu/superfish.js 2018-10-05 10:50:59.000000000 +0100
@@ -1,13 +1,13 @@
/*
- * jQuery Superfish Menu Plugin
- * Copyright (c) 2013 Joel Birch
+ * jQuery Superfish Menu Plugin - v1.7.10
+ * Copyright (c) 2018 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
View superfish-1.7.4-1.7.6.diff
--- /var/folders/5h/n5kgg5w13h77n1ffpd4hm2800000gn/T/xxXKfj_superfish.js 2018-10-05 10:45:22.000000000 +0100
+++ /Users/gary/Local Sites/genesis/app/public/wp-content/themes/genesis/lib/js/menu/superfish.js 2018-10-05 10:45:23.000000000 +0100
@@ -1,13 +1,13 @@
/*
- * jQuery Superfish Menu Plugin
- * Copyright (c) 2013 Joel Birch
+ * jQuery Superfish Menu Plugin - v1.7.6
+ * Copyright (c) 2015
*
* Dual licensed under the MIT and GPL licenses:
@GaryJones
GaryJones / fix-category-counts.php
Last active Aug 6, 2018
Fix WordPress category (or other taxonomy) counts, after incomplete import, etc.
View fix-category-counts.php
<?php
// Can drop into {yourtheme}/functions.php and then hit the site.
$update_taxonomy = 'category'; // Set to the correct taxonomy.
$get_terms_args = array(
'taxonomy' => $update_taxonomy,
'fields' => 'ids',
'hide_empty' => false,
@GaryJones
GaryJones / fix-comment-counts.php
Created Aug 1, 2018
Fix WordPress comment counts (after incomplete import, etc.
View fix-comment-counts.php
<?php
// Can drop code into top of {yourtheme}/functions.php and then hit the site.
// Fix comment counts.
$post_types = ['post']; // Set to the post types to fix.
$post_status = ['publish', 'pending', 'draft']; // Set to the post status to fix.
global $wpdb;
$posts = $wpdb->get_results(
@GaryJones
GaryJones / per-site-user-fields.php
Created Jul 9, 2018
WordPress plugin to store custom and built-in user fields on a per-site basis for WP multisite. Good for multilingual setups. Customise to your needs.
View per-site-user-fields.php
<?php
/**
* Per-Site User Fields
*
* @package GaryJones\PerSiteUserfields
* @author Gary Jones
* @copyright 2018 Gary Jones, Gamajo
* @license GPL-2.0-or-later
*
* @wordpress-plugin
@GaryJones
GaryJones / functions.php
Last active Mar 15, 2019
Genesis: Remove microdata attributes
View functions.php
<?php
// Copy everything below this line in to your functions.php file.
/**
* Remove microdata attributes from Genesis 2.6.0.
*
* May need adapting for other versions of Genesis.
*
* @author Gary Jones, Gamajo.
@GaryJones
GaryJones / notes.md
Last active Mar 31, 2019
Add PHPCS + WPCS to Sublime Text 3
View notes.md

Install PHP_CodeSniffer (PHPCS) via git

You can use the .phar for PHPCS, but it's easier to pull the repo down from git to then choose what version to use.

cd ~
mkdir -p code
cd code
git clone https://github.com/squizlabs/PHP_CodeSniffer.git phpcs
@GaryJones
GaryJones / functions.php
Created Oct 11, 2016
Genesis: Add classes to footer widget areas container, depending on the configured number of footer widget areas.
View functions.php
<?php
add_filter( 'genesis_footer_widget_areas', 'gmj_add_footer_widgets_classes', 10, 2 );
/**
* Add classes to footer widget areas container, depending on the configured number of footer widget areas.
*
* @param string $output Existing footer widget areas container markup.
* @param int $footer_widgets Number of configured footer widget areas.
* @return string Possibly amended markup for footer widget areas container.
*/
@GaryJones
GaryJones / .htaccess
Last active Dec 4, 2018
Security Headers
View .htaccess
<IfModule mod_headers.c>
# HSTS - force redirect to HTTPS at the browser level.
# Submit for Chrome preload list at https://hstspreload.appspot.com/
# Header always set Strict-Transport-Security: "max-age=31536000; includeSubDomains; preload" env=HTTPS
# X-Xss-Protection
Header always set X-XSS-Protection "1; mode=block"
# Stop clickjacking by only allowing us to frame our own site
Header always set X-Frame-Options "SAMEORIGIN"
@GaryJones
GaryJones / functions.php
Created Sep 5, 2016
Translate specific WP string.
View functions.php
<?php
// Untested, but should give you an idea.
add_filter( 'gettext', 'claire_rename_color_to_colour' );
/**
* Rename the exact WP string "Color" to "Colour".
*
* Doesn't affect non-exact strings.
*
You can’t perform that action at this time.