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
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query | |
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php | |
*/ | |
$args = array( |
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
// see: http://coenraets.org/blog/2012/03/using-backbone-js-with-jquery-mobile/ | |
// for context. | |
// this modifies original code (above) to also watch for dialogs being hidden | |
$('div[data-role="page"],div[data-role="dialog"]').live('pagehide', function (event, ui) { | |
$(event.currentTarget).remove(); | |
}); |
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
// HELPER: #key_value | |
// | |
// Usage: {{#key_value obj}} Key: {{key}} // Value: {{value}} {{/key_value}} | |
// | |
// Iterate over an object, setting 'key' and 'value' for each property in | |
// the object. | |
Handlebars.registerHelper("key_value", function(obj, fn) { | |
var buffer = "", | |
key; |
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
<?php | |
/** | |
* https://gist.github.com/wkw/5752757 | |
* forked from pamelafox-coursera (https://gist.github.com/pamelafox-coursera) | |
* | |
*/ | |
class CalendarEvent { | |
/** | |
* |
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
<?php | |
/* | |
/* enter your Twitter username here */ | |
DEFINE('TWITTER_USERNAME', 'replace-me'); | |
/* | |
/* this is where you put in all of your secret spices */ | |
/* check out this guide for an explaination: http://stackoverflow.com/questions/12916539/simplest-php-example-retrieving-user-timeline-with-twitter-api-version-1-1/15314662#15314662 */ |
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
// from Andrew Whitaker and Jazzbo, http://stackoverflow.com/a/15554920/161625 | |
$.fn.changeElementType = function(newType) { | |
var newElements = []; | |
$(this).each(function() { | |
var attrs = {}; | |
$.each(this.attributes, function(idx, attr) { | |
attrs[attr.nodeName] = attr.nodeValue; | |
}); |
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
/** | |
* utility to check if more posts available in the loop, avoiding side-effects | |
* mentioned in the "Note" on this page: http://codex.wordpress.org/Function_Reference/have_posts | |
* if more are available, it will advance the internal counter by calling the_post() | |
* -- this function goes in functions.php or (RootsTheme: lib/custom.php) | |
*/ | |
if( !function_exists('more_posts') ){ | |
function more_posts() { | |
global $wp_query; | |
$hasPostsLeft = $wp_query->current_post + 1 < $wp_query->post_count; |
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
// source: https://uproot.us/forums/questions/1511/importing-data | |
/* | |
* ============================== EXPERIMENTAL CUSTOM FIELDS SUITE FIELD SYNC ============================ | |
* | |
* Importing posts with custom fields even when their names match those in CFS groups. still doesn't make | |
* them visible to CFS. The map_fields_values below is from a forum post on uproot's site: | |
* https://uproot.us/forums/questions/1511/importing-data | |
* | |
* I have hard-coded the group ID for staff_bios into _sync_cfs_fields(). Call this function after | |
* import. |
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
// | |
// referencing v3.1.5 of WPML sitepress plugin | |
// in file: sitepress-multilingual-cms/sitepress.class.php | |
// at or near line: 5898 (inside method `convert_url`) | |
// | |
Add these three lines of code after the first larger if/block. | |
if ( is_null( $code ) ) { | |
$code = $default_language; |
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
/* ====================================================================================== | |
//! -- On Demand Image Sizing -- | |
Experimental code for generating custom image sizes on demand. | |
http://wordpress.stackexchange.com/a/124790 | |
From the author... | |
"When an image is then requested in a particular size, | |
which is not yet generated, it will be created only that once." | |
====================================================================================== */ |
OlderNewer