Skip to content

Instantly share code, notes, and snippets.

View GaryJones's full-sized avatar

Gary Jones GaryJones

View GitHub Profile
@GaryJones
GaryJones / en_GB.po
Created November 14, 2014 23:11
WP Rocket en_GB.po
# Copyright (C) 2014 WP Rocket
# This file is distributed under the same license as the WP Rocket package.
msgid ""
msgstr ""
"Project-Id-Version: WP Rocket 2.3.6\n"
"Report-Msgid-Bugs-To: http://wp-rocket.me/\n"
"POT-Creation-Date: 2014-10-06 14:18:51+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
<?php
// Add a post signature for multiple authors.
// All signature divs will have a class of .signature for common styling
// then .signature-cat as the default and .signature-tracey for the guest
// as class modifiers (different background image, or background position
// if using sprites etc.)
// If it's not a single entry of any post type, return.
if ( is_single() ) {
return;
@GaryJones
GaryJones / big-brother.php
Created October 2, 2014 10:31
Big Brother eviction of @tarendai's Davina swear.
<?php
// Solution for https://github.com/Tarendai/davina
/**
* Remove filter or action method added from an unassigned object.
*
* Solves the immediate case. Not bothered to generalise it.
*
* @global array $wp_filter Storage for all of the filters and actions.
@GaryJones
GaryJones / phpmd.xml
Created September 12, 2014 15:04
PHPMD Ruleset for a WordPress Theme
<?xml version="1.0"?>
<ruleset name="phpmd.xml"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>PHPMD Ruleset for a WordPress Theme</description>
<rule ref="rulesets/cleancode.xml/BooleanArgumentFlag" />
<rule ref="rulesets/cleancode.xml/ElseExpression" />
<rule ref="rulesets/cleancode.xml/StaticAccess" />
@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),
@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:258eaa3eb74aa263d0c3
Created August 14, 2014 22:17
Example _site-navigation.scss for Genesis Sample. Only a starting point, so customise as needed!
// Navigation (.genesis-nav-menu)
$navigation-font-size: 16px !default;
$navigation-line-height: 1 !default;
$navigation-link-color: #000 !default;
$navigation-link-color-hover: #e5554e !default;
$navigation-link-padding: 30px 24px;
// Navigation submenus
$navigation-submenu-width: 200px;
$navigation-submenu-link-font-size: 14px !default;
<?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 / icons.json
Created July 16, 2014 14:42
Font Awesome 4.1.0 icons as JSON
{
"icons": [
{
"name": "Glass",
"id": "glass",
"unicode": "f000",
"created": 1,
"categories": [
"Web Application Icons"
]
@GaryJones
GaryJones / nav-extras.php
Last active April 30, 2020 15:14 — forked from studiopress/nav-extras.php
Add Genesis Primary Nav Extras features in manually.
<?php
// Don't include the above <?php when copying
add_filter( 'wp_nav_menu_items', 'prefix_primary_nav_extras', 10, 2 );
/**
* Filter menu items, appending either a search form or today's date.
*
* @param string $menu HTML string of list items.
* @param stdClass $args Menu arguments.