Skip to content

Instantly share code, notes, and snippets.

View bradyvercher's full-sized avatar

Brady Vercher bradyvercher

View GitHub Profile
@bradyvercher
bradyvercher / audiotheme-genesis.css
Last active March 22, 2017 08:59
Custom CSS for integrating AudioTheme with Genesis 2.0
/* General */
.archive .audiotheme {
margin-bottom: 40px;
padding: 40px 40px 20px 40px;
background: #fff;
}
.audiotheme .audiotheme-archive-title {
margin-bottom: 1.6rem;
@bradyvercher
bradyvercher / local-error-handler.php
Last active September 21, 2023 19:39
Suppress errors generated by specified WordPress plugins to make developing with debug mode on less painful.
<?php
/**
* Suppress errors generated by specified WordPress plugins.
*
* Include in the auto_prepend_file php.ini directive to ignore globally.
*
* @see http://plugins.trac.wordpress.org/browser/ostrichcize/tags/0.1/ostrichcize.php#L146
*
* @param string $errno The error number.
* @param string $errstr The error message.
@bradyvercher
bradyvercher / wp-revisions-bookmarklet.md
Created October 25, 2013 16:18
A bookmarklet to convert [#####] text nodes on a page to links pointing to the corresponding changeset on WordPress Trac.

Bookmarklet

(function e(t){var n=/\[([0-9]{5})\]/m;if(t.childNodes.length>0){for(var r=0;r<t.childNodes.length;r++){e(t.childNodes[r])}}if(3===t.nodeType&&n.test(t.nodeValue)){var i=t.nodeValue.match(n).pop(),s=document.createElement("a");s.appendChild(document.createTextNode(i));s.setAttribute("href","http://core.trac.wordpress.org/changeset/"+i+"/trunk");t.parentNode.insertBefore(s,t.nextSibling);t.parentNode.insertBefore(document.createTextNode(" ["),t.nextSibling);t.parentNode.insertBefore(document.createTextNode("]"),s.nextSibling);t.nodeValue=t.nodeValue.replace(n,"")}})(document.body)

Source

( function traverse( node ) {
@bradyvercher
bradyvercher / hidpi-gallery-thumbnails.php
Created November 1, 2013 21:30
WordPress: Use HiDPI thumbnails with the same aspect ratio as the original image in gallery shortcodes.
@bradyvercher
bradyvercher / desaturate-menu-image-icons.php
Created December 13, 2013 16:48
WordPress: Desaturate admin menu icons added as images before WordPress 3.8 to keep them from stealing attention.
<?php
/**
* Plugin Name: Desaturate Menu Image Icons
* Description: Desaturate admin menu icons added as images before WordPress 3.8 to keep them from stealing attention.
* Version: 1.0.0
* Author: Brady Vercher
* Author URI: http://www.blazersix.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
<?php
/**
* Return a base64 encoded SVG icon for use as a data URI.
*
* @param string $path Path to SVG icon.
* @return string
*/
function audiotheme_encode_svg( $path ) {
$path = path_is_absolute( $path ) ? $path : AUDIOTHEME_DIR . $path;
@bradyvercher
bradyvercher / americanaura-widget-classes.php
Created December 27, 2013 23:33
Methods for retrieving widget instances.
<?php
function americanaura_widget_classes( $params ) {
if ( 'pinboard' != $params[0]['id'] ) {
return $params;
}
// If a track has a file add a '.js-playable' class to the widget container
if ( 'audiotheme-track' == $widget_id_base ) {
$instance = americanaura_get_widget_instance( $params[0]['widget_id'], $params[1]['number'] );
if ( isset( $instance['post_id'] ) && get_audiotheme_track_file_url( $instance['post_id'] ) ) {
@bradyvercher
bradyvercher / cache-post-thumbnails.php
Created January 9, 2014 17:21
WordPress: Cache post thumbnail attachments that appear in a WP_Query loop.
<?php
/**
* Plugin Name: Cache Post Thumbnails
* Description: Prime the post thumbnails cache for individual loops.
* Version: 1.0.0
* Author: Brady Vercher
* Author URI: http://www.blazersix.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@bradyvercher
bradyvercher / cpt-class.mustache
Created February 27, 2014 16:25
Mustache templates for generating WordPress CPT code.
/**
* {{singular}} CPT
*
* @package {{plural}}
* @author Your Name <[email protected]>
* @license http://www.gnu.org/licenses/gpl-2.0.html
* @link http://www.blazersix.com/wordpress-code-generators/
*
* @todo Remove unused code and update where needed.
*
@bradyvercher
bradyvercher / child-theme.js
Last active August 29, 2015 13:58
A concept for overriding parent theme JavaScript in a child theme.
window.themeName = window.themeName || {};
(function( window, $, undefined ) {
'use strict';
// Override the carousel config properties.
themeName.config.carousel.autoPlay = true;
themeName.setupCarousel = function() {
// Override the carousel set up without affecting anything else.