Skip to content

Instantly share code, notes, and snippets.

View sunnyratilal's full-sized avatar

Sunny Ratilal sunnyratilal

View GitHub Profile
// Open up the media manager to handle editing image metadata.
$('#soliloquy-area').on('click.soliloquyModify', '.modify-image', function(e) {
e.preventDefault();
var soliloquy_frames = {}; // Store our workflows in an object
var frame_id = $(this).next().attr('id').split('-')[3]; // Unique ID for each workflow
var default_view = wp.media.view.AttachmentsBrowser; // Store the default view to restore it later
// If the media frame already exists, reopen it.
if ( soliloquy_frames[frame_id] ) {
soliloquy_frames[frame_id].open();
// Use the new media manager to handle uploads to Soliloquy.
$('#soliloquy-area').on('click.soliloquyUpload', '#soliloquy-upload', function(e){
// Prevent the default action from occuring.
e.preventDefault();
// Variable to hold our media applicaton.
var soliloquy_frame;
// If the media frame already exists, reopen it and return.
if ( soliloquy_frame ) {
@sunnyratilal
sunnyratilal / gist:5650341
Created May 25, 2013 19:03 — forked from thomasgriffin/gist:4953041
Rendering custom attachment fields in the new media manager via Backbone.
/**
* The code below renders additional custom attachment fields into the
* new media manager.
*
* I am assuming you are using your own custom media modal frame. By
* extending the default Attachment.Details subview, we can append our
* custom fields to the default fields listed.
*
* In the initialize function, we ensure that our changes are always up
* to date by "listening" to our model's change event and updating the
// Checks to see if jQuery is loaded and if it is a high enough version; if not, jQuery is loaded.
this.loadjQuery = function(){
// Store localized copy of our main object instance.
var self = this;
// If jQuery is not present or not the correct version, load it asynchronously and fire the rest of the app once jQuery has loaded.
if ( window.jQuery === undefined || window.jQuery.fn.jquery !== '1.9.1' ) {
var om = document.createElement('script');
om.src = '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js';
om.onload = om.onreadystatechange = function(){
// Checks to see if jQuery is loaded and if it is a high enough version; if not, jQuery is loaded.
this.loadjQuery = function(){
// Store localized copy of our main object instance.
var self = this;
// If jQuery is not present or not the correct version, load it asynchronously and fire the rest of the app once jQuery has loaded.
if ( window.jQuery === undefined || window.jQuery.fn.jquery !== '1.9.1' ) {
var om = document.createElement('script');
om.src = '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js';
om.onload = om.onreadystatechange = function(){
# custom login link
RewriteRule ^login$ http://localhost/whitelabel/wp-login.php [NC,L]
<?php
add_action( 'init', function() {
register_taxonomy( 'some-taxonomy', 'post', array(
'show_ui' => true,
'rewrite' => false,
'public' => true,
'labels' => array(
'name' => 'Some Taxonomy',
'singular_name' => 'Some Taxonomy',
function wptest() {
TESTROOT=/Users/nacin/Sites/tests
ARGS="--colors $@"
FORCE=0
DEBUG=0
REPLACE=$(echo $ARGS | sed -e 's/ -f\>//')
if [ "$ARGS" != "$REPLACE" ]; then
FORCE=1
ARGS=$REPLACE
// Modific default settings
{
// Name of a region icon
// Valid icon names are dot, circle, bookmark and cross
"region_icon": "circle",
// You can use your commands instead of plain "git" or "svn"
// e.g. "/usr/bin/git" or "C:\bin\git.exe"
"vcs": [
["svn", "/usr/bin/svn"],
<?php
/*
* Plugin Name: Hacky Taxonomy Archives
* Description: Don't use this on a live site, plz. Proof of concept for Aaron Holbrook.
* Author: Andrew Nacin
*/
add_action( 'template_redirect', function() {
global $wp_rewrite;
$taxonomy = 'fruits';