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
/** | |
* Get CFS fields for a post. | |
* pass post_id in $_GET('id') | |
* | |
* invoke with: /wp-admin/admin-ajax.php?action=cfs_values&id=10 | |
* include raw=1 to get the unencoded data: /wp-admin/admin-ajax.php?action=cfs_values&id=10&raw=1 | |
*/ | |
function ajax_get_cfs_post_values(){ | |
$options = array('format' => 'raw'); |
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
# This is a general-purpose function to ask Yes/No questions in Bash, either | |
# with or without a default answer. It keeps repeating the question until it | |
# gets a valid answer. | |
ask() { | |
# http://djm.me/ask | |
while true; do | |
if [ "${2:-}" = "Y" ]; then | |
prompt="Y/n" |
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
/*jslint regexp: true, maxerr: 50, indent: 2 */ | |
(function (global) { | |
"use strict"; | |
function URLUtils(url, baseURL) { | |
var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/); | |
if (!m) { | |
throw new RangeError(); | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
<?php | |
/* Set up: */ | |
class Namespace_Module_Block_Adminhtml_News_Edit_Tab_Linking { | |
protected function _prepareForm(){ | |
... | |
$fieldSet->addField('product_categories', 'multiselect', |
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; |
OlderNewer