Skip to content

Instantly share code, notes, and snippets.

View GaryJones's full-sized avatar

Gary Jones GaryJones

View GitHub Profile
<?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.
@GaryJones
GaryJones / .jscsrc
Last active November 2, 2018 19:49
JSCS config file
{
"requireSpacesInConditionalExpression": true,
"requireSpacesInFunction": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunction": {
"beforeOpeningRoundBrace": true
},
"requireMultipleVarDecl": "onevar",
"requireSpacesInsideObjectBrackets": "all",
@GaryJones
GaryJones / .csscomb.json
Created July 5, 2014 08:35
CSScomb config file
{
"exclude": ["node_modules/**", "vendor/**"],
"verbose": true,
"always-semicolon": true,
"block-indent": "\t",
"colon-space": [0, 1],
"color-case": "lower",
"color-shorthand": true,
"combinator-space": [1, 1],
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/*'
@GaryJones
GaryJones / gist:e680bf0544cead75a213
Created May 21, 2014 10:51
Handle is_front_page() edge case settings
<?php
/*
is_front_page() requires that if the static radio button is chosen, that
a page is assigned to the Front Page dropdown. Without the latter,
is_front_page() doesn't return true for /.
is_home() will return true for / in this case, but that also will be
true for the page assigned as the blog page which already has a title.
The check therefore needs to cover several factors.
@GaryJones
GaryJones / .csscomb.json
Last active November 2, 2018 19:49
[Replaced] CSSComb file for WP core.
See https://github.com/cedaro/grunt-wp-css/blob/develop/tasks/config/default.json
@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

@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 );