Skip to content

Instantly share code, notes, and snippets.

add_action( 'init', 'remove_stuff' );
function remove_stuff() {
if ( class_exists( 'TGM_Soliloquy' ) )
remove_action( 'tgmsp_soliloquy_settings', array( TGM_Soliloquy::$instance, 'output_soliloquy_plugin_settings' ) );
}
@GaryJones
GaryJones / functions.php
Created February 23, 2012 13:21
Cache bust the style.css reference in WordPress.
<?php
add_filter( 'stylesheet_uri', 'gmj_stylesheet_uri' );
/**
* Cache bust the style.css reference.
*
* Includes the file last modified time as a querystring.
*
* @author Gary Jones
* @link https://gist.github.com/1892762
/**
* Loads a Flash Audio Player if browser does not support HTML5 audio element.
* http://wpaudioplayer.com/
*
* @uses wp-includes/js/swfobject.js
*/
var AudioPlayer=function(){var H=[];var D;var F="";var A={};var E=-1;var G="9";function B(I){if(document.all&&!window[I]){for(var J=0;J<document.forms.length;J++){if(document.forms[J][I]){return document.forms[J][I];break}}}return document.all?window[I]:document[I]}function C(I,J,K){B(I).addListener(J,K)}return{setup:function(J,I){F=J;A=I;if(swfobject.hasFlashPlayerVersion(G)){swfobject.switchOffAutoHideShow();swfobject.createCSS("p.audioplayer_container span","visibility:hidden;height:24px;overflow:hidden;padding:0;border:none;")}},getPlayer:function(I){return B(I)},addListener:function(I,J,K){C(I,J,K)},embed:function(I,K){var N={};var L;var J={};var O={};var M={};for(L in A){N[L]=A[L]}for(L in K){N[L]=K[L]}if(N.transparentpagebg=="yes"){J.bgcolor="#FFFFFF";J.wmode="transparent"}else{if(N.pagebg){J.bgcolor="#"+N.pagebg}J.wmode="opaque"}J.menu="false";for(
@pdewouters
pdewouters / gist:2870362
Created June 4, 2012 19:35
WordPress dropdown select element for mobile navigation
<?php
class Walker_Nav_Menu_Mobile extends Walker_Nav_Menu{
var $to_depth = -1;
function start_lvl(&$output, $depth){
$output .= '</option>';
}
function end_lvl(&$output, $depth){
<?php
/**
* Favorite Widget
*
* @package Core_Functionality
* @since 1.0.0
* @link https://github.com/billerickson/Core-Functionality
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
@nacin
nacin / jquery-html-category-descriptions.php
Created June 19, 2012 13:33
HTML Category Descriptions
<?php
add_action( 'init', 'jquery_unfiltered_html_for_term_descriptions' );
add_action( 'set_current_user', 'jquery_unfiltered_html_for_term_descriptions' );
function jquery_unfiltered_html_for_term_descriptions() {
remove_filter( 'pre_term_description', 'wp_filter_kses' );
remove_filter( 'pre_term_description', 'wp_filter_post_kses' );
if ( ! current_user_can( 'unfiltered_html' ) )
add_filter( 'pre_term_description', 'wp_filter_post_kses' );
}
@PeteMall
PeteMall / plugin-last-updated.php
Created June 19, 2012 20:00
Display the last updated date for all plugins from the WordPress.org plugins repo.
<?php
/*
Plugin Name: Plugin Last Updated
Version: 1.0
License: GPL
Author: Pete Mall, Range
Author URI: http://petemall.com/
Description: Display the last updated date for all plugins from the <a href="http://wordpress.org/extend/plugins/">WordPress.org plugins repo</a>.
*/
@szbl
szbl / get-terms-for-post-type.php
Created July 17, 2012 05:10
get_terms_for_post_type()
<?php
//
// Assumption: we have two post types, "books" and "videos" and a shared hierarchical taxonomy called "library-section"
//
/*
* Pulls all non-empty terms for a given post type.
*
* @param $taxonomy The name of the taxonomy, e.g. "library-section"
* @param $post_type The name of the post type, e.g. "book"
@billerickson
billerickson / mobile-menu.js
Created August 7, 2012 17:06
WordPress Menu as Select Dropdown (js)
jQuery(document).ready(function($){
// Create the dropdown base
$('<div class="mobile-menu"><form><select onchange="if (this.value) window.location.href=this.value" /></form></div>').prependTo("#wrap");
// Create default option "Go to..."
$("<option />", {
"selected": "selected",
"value" : "",
"text" : "Go to..."
<?php
/**
* Grid Loop Pagination
* Returns false if not grid loop.
* Returns an array describing pagination if is grid loop
*
* @author Bill Erickson
* @link http://www.billerickson.net/a-better-and-easier-grid-loop/
*