Skip to content

Instantly share code, notes, and snippets.

View GaryJones's full-sized avatar

Gary Jones GaryJones

View GitHub Profile
@GaryJones
GaryJones / envira-gallery-tweak.php
Created February 11, 2014 09:01
Envira Gallery tweak
/**
* {{singular}} Custom Post Type.
*
* @package {{plural}}
* @author Your Name <email@example.com>
* @license GPL-2.0+
* @link http://www.blazersix.com/wordpress-code-generators/
*
* @todo Remove unused code and update where needed.
*
@GaryJones
GaryJones / x-core.php
Created March 8, 2014 20:25
Main file for core library plugin.
<?php
/**
* X Core Plugin
*
* @package X_Core
* @author Gary Jones <me@example.com>
* @license GPL-2.0+
* @copyright 2014 Gary Jones
*
* @wordpress-plugin
@GaryJones
GaryJones / my-plugin.js
Last active August 29, 2015 13:59
JavaScript module template for plugins
/* global myPluginL10n */
var myPlugin = ( function ( $ ) {
function myPrivateFunction() {
}
function getStuff( id ) { // Private function
var jqxhr = $.get( myPlugin.ajax_url + '?x=y&id=' + id );
@GaryJones
GaryJones / poedit-questions.md
Last active August 29, 2015 14:01
POEdit Keyword Header Value questions

Thanks for looking :-)

I was looking at some typical POEdit keyword header value in WordPress plugins and themes - e.g.:

'__;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n';

There's several things wrong here, but the oddity is:

_c,_nc:4c,1,2

filter:
excluded_paths:
- 'vendor/*'
- 'tests/*'
- 'src/wp-admin/includes/class-ftp*'
- src/wp-admin/includes/class-pclzip.php
- 'src/wp-content/*'
- 'src/wp-includes/ID3/*'
- 'src/wp-includes/SimplePie/*'
- 'src/wp-includes/Text/*'
<?php
/* File level DocBlock here - includes/class-remove-h1-format.php */
/* Class level DocBlock here */
class Remove_H1_Format {
/*
* Modify TinyMCE editor to remove H1.
*/
public function remove( $init ) {
// GJ: No need for the filter - if they don't want it running, deactivate the plugin.
@GaryJones
GaryJones / gist:635b1aaea8a45f6c8833
Created August 21, 2014 23:13
Can this SCSS be optimised to avoid the position static / left auto / opacity 1 duplication?
.genesis-nav-menu {
// ... other styles
.menu-item:hover,
.menu-item-hover {
position: static;
> .sub-menu { // Note the >
left: auto;
opacity: 1;
@GaryJones
GaryJones / gist:cfe0f917f144da8c908e
Last active August 29, 2015 14:06
Gamajo Accessible Menu plugin
/**
* Gamajo Accessible Menu.
*
* Improves menu accessibility in two ways:
* * Adds a delay to submenus disappearing when moving the mouse away.
* * Makes submenus appear when tabbing through menu items with the keyboard.
*
* Kudos to Rian Rietveld for the code on which this plugin is based.
*
* After enqueueing this file (or concatenating it with your theme JS file),