This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JS for loop | |
for (var i = 0, len = DEF; i < len; i++) { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Retrieve metabox content | |
global $DEF_mb; | |
<?php $DEF_mb->the_value('DEF'); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place in functions.php | |
require_once('library/metaboxes/DEF-spec.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* WordPress MetaBox Spec | |
*/ | |
<?php | |
$DEF_mb = new WPAlchemy_MetaBox(array( | |
'id' => 'DEF', | |
'title' => 'DEF', | |
'types' => array('page'), | |
'context' => 'normal', // defaults to "normal" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Meta control for WordPress Pages | |
* | |
*/ | |
<div class="my_meta_control"> | |
<div> | |
<?php $mb->the_field('DEF'); ?> | |
<label for="<?php $mb->the_name(); ?>">DEF</label> | |
<input type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>"/> | |
<span>DEF</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Place this code after your Google Analytics scripts | |
*/ | |
$(function() { | |
/* any links to PDFs are tracked with GA */ | |
$('a[href$="pdf"]').click(function(e){ | |
/* grab only the file name without the full path */ | |
var fullpath = $(this).attr('href'); | |
var filename = fullpath.substr(fullpath.lastIndexOf("/")+1, fullpath.length); | |
_gaq.push(['_trackPageview', '/'+filename]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Today's little useless tidbit converts a url's query string into a hash | |
# set of k/v pairs in a way that merges duplicates and massages empty | |
# querystring values | |
def qs_to_hash(querystring) | |
keyvals = query.split('&').inject({}) do |result, q| | |
k,v = q.split('=') | |
if !v.nil? | |
result.merge({k => v}) | |
elsif !result.key?(k) |