Skip to content

Instantly share code, notes, and snippets.

View mfields's full-sized avatar

Michael Fields mfields

  • Portland, Oregon, USA
View GitHub Profile
<?php
$images = get_children( array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'post_mime_type' => 'image',
'orderby' => 'menu_order',
'order' => 'ASC',
) );
if ( $images ) {
/**
* 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(
<?php
$x11 = array(
'aliceblue' => array( 240, 248, 255 ),
'antiquewhite' => array( 250, 235, 215 ),
'aqua' => array( 0, 255, 255 ),
'aquamarine' => array( 127, 255, 212 ),
'azure' => array( 240, 255, 255 ),
'beige' => array( 245, 245, 220 ),
'bisque' => array( 255, 228, 196 ),
'black' => array( 0, 0, 0 ),
<a href="http://trunk/?p=65"><img class="attachment-thumbnail wp-post-image" title="alaska-1" src="http://wp-content/uploads/2012/05/alaska-1-150x150.jpg" alt="alaska-1" width="150" height="150" />
<a href="http://trunk/?p=65">Alas</a>
<a href="http://trunk/?p=64"><img class="attachment-thumbnail wp-post-image" title="Red flower" src="http://wp-content/uploads/2012/05/flower-red-150x150.jpg" alt="Red flower" width="150" height="150" />
<a href="http://trunk/?p=64">Red Flower</a>
<a href="http://trunk/?p=122"><img class="attachment-thumbnail wp-post-image" title="meow" src="http://wp-content/uploads/2012/05/meow-150x150.jpg" alt="meow" width="150" height="150" />
<a href="http://trunk/?p=122">Meow!</a>
<a href="http://trunk/?p=57"><img class="attachment-thumbnail wp-post-image" title="rhino" src="http://wp-content/uploads/2012/05/rhino-150x150.jpg" alt="rhino" width="150" height="150" />
@mfields
mfields / gist:3231663
Created August 1, 2012 23:55
Get Audio
<?php
$audio = get_children( array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'post_mime_type' => 'audio',
'orderby' => 'menu_order',
'order' => 'ASC'
) );
?>
<?php
final class MfieldsDumpHook {
/**
* A list of hooks to dump
*/
private static $hooks = null;
/**
* Exclude asides from the blog queries.
*/
function mytheme_pre_get_posts( $query = false ) {
// Bail if not home, not a query, not main query.
if ( ! is_home() || ! is_a( $query, 'WP_Query' ) || ! $query->is_main_query() )
return $query;
// Exclude aside formatted posts from the main query.
@mfields
mfields / gist:3950447
Created October 25, 2012 04:43
Raven Post Labels
<?php
/**
* Post Label.
*
* Returns a noun representing the type or format of the global
* post object. This function is used internally by the
* raven_entry_meta_taxonomy() function to create a sentence much
* like the following: "This Status Update is filed under News."
* where "Status Update" is the post label and "News" is the category.
@mfields
mfields / gist:3950905
Created October 25, 2012 06:47
Contain Floats
.entry-content:after {
clear: both;
content: '';
display: block;
}
@mfields
mfields / gist:3951260
Created October 25, 2012 07:49
Twenty Twelve: Google fonts enqueue.
/**
* An Example of how Twenty Twelve Enqueues a Google font.
*
* This is interesting because it allows translators to disable the font
* as well as conditionally load subsets.
*/
function test_theme_enqueue_opensans() {
/* translators: If there are characters in your language that are not supported
by Open Sans, translate this to 'off'. Do not translate into your own language. */