Skip to content

Instantly share code, notes, and snippets.

( function( api ) {
'use strict';
// Add callback for when the header_textcolor setting exists.
api( 'header_textcolor', function( setting ) {
var isHeaderTextDisplayed, linkSettingValueToControlActiveState;
/**
* Determine whether the site title and tagline should be displayed.
*
@jjeaton
jjeaton / .gitignore
Created August 5, 2015 01:54
WordPress root .gitignore. Ignore everything and then opt-in (exclude from the ignore) for your custom code.
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@chrisdc
chrisdc / .jscsrc
Last active November 2, 2018 19:48
Options file for JSCS
{
"disallowKeywordsOnNewLine": ["else"],
"disallowMixedSpacesAndTabs": "smart",
"disallowNewlineBeforeBlockStatements": true,
"disallowSpaceAfterObjectKeys": true,
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowTrailingWhitespace": true,
"requireBlocksOnNewline": true,
@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" />
@norcross
norcross / yoast-ga-menu-move.php
Last active August 29, 2015 14:06
move Yoast Google Analytics top-level nav to a sub menu
/**
* move the main settings page for Yoast Google Analytics
* from it's own parent menu into a submenu page in either
* the Yoast SEO menu or in the general settings
*
* @return null
*/
function rkv_yoast_ga_menu() {
// check for the Yoast GA class in the event the plugin
@jtsternberg
jtsternberg / $-cache-with-find.js
Last active January 22, 2018 08:44
jQuery selector cache with reset (original: http://eamann.com/tech/selector-caching-jquery/). If commenting, please ping me on Twitter, same username.
function Selector_Cache() {
var elementCache = {};
var get_from_cache = function( selector, $ctxt, reset ) {
if ( 'boolean' === typeof $ctxt ) {
reset = $ctxt;
$ctxt = false;
}
var cacheKey = $ctxt ? $ctxt.selector + ' ' + selector : selector;
@GaryJones
GaryJones / readme.md
Last active July 14, 2019 20:46
Custom Featured Post Widget plugin: Skeleton for amending the output of the Genesis Featured Post widget.
@jdevalk
jdevalk / archive-speaking_event.php
Last active December 12, 2021 20:13
Genesis helper code for schema
<?php
add_filter( 'genesis_attr_content', 'yoast_schema_empty', 20 );
add_filter( 'genesis_attr_entry', 'yoast_schema_event', 20 );
add_filter( 'genesis_attr_entry-title', 'yoast_itemprop_name', 20 );
add_filter( 'genesis_attr_entry-content', 'yoast_itemprop_description', 20 );
add_filter( 'genesis_post_title_output', 'yoast_title_link_schema', 20 );
/**
* We'll use the post info output to add more meta data about the event.
@zachharkey
zachharkey / README.md
Created November 28, 2012 21:28
SublimeText2 CSSTidy Custom Templates

Custom CSSTidy Templates for Sublime Text 2

The CSSTidy package for SublimeText 2 works great for toggling between different CSS formats, but none of the default options output CSS consistent with the Drupal CSS coding standards with selectors, braces and properties indented and formatted like so:

selector {
  property: value; 
}

CSSTidy allows you to add your own templates, but the documentation is sparse, then there's the matter of the Sublime Text 2 integration. If I hadn't been deeply procrastinating, I would not have had th patience to figure it all out. Here's what to do:

@thefuxia
thefuxia / plugin-class-demo.php
Last active April 11, 2024 13:50
Plugin Class Demo
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: Plugin Class Demo
* Description: How I am using the base class in plugins.
* Plugin URI:
* Version: 2012.09.29
* Author: Fuxia Scholz
* License: GPL
* Text Domain: plugin_unique_name
* Domain Path: /languages