This file contains hidden or 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
error_reporting(E_ALL); ini_set('display_errors', 1); | |
define( 'WP_DEBUG', true); |
This file contains hidden or 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
// http://stackoverflow.com/questions/8231058/file-type-validation-with-javascript | |
return fname.substr((Math.max(0, fname.lastIndexOf(".")) || Infinity) + 1); | |
return fname.substr((~-fname.lastIndexOf(".") >>> 0) + 2); |
This file contains hidden or 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
// http://speckyboy.com/2014/06/25/content-overlays-css3-transitions/ | |
(function(){ | |
// handle the swanky navigation/section stuff | |
//////////////////////////////////////////////////////////// | |
var nav_links = document.querySelectorAll("nav.cmn-overlays-nav a"); | |
This file contains hidden or 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
global $wp_query; | |
var_dump($wp_query->query_vars); |
This file contains hidden or 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
var someInput = document.querySelector('input'); | |
someInput.addEventListener('click', myFunc, false); | |
someInput.myParam = 'This is my parameter'; | |
function myFunc(evt){ | |
window.alert( evt.target.myParam ); | |
} |
This file contains hidden or 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
function taxonomy_checklist_checked_ontop_filter ($args) | |
{ | |
$args['checked_ontop'] = false; | |
return $args; | |
} | |
add_filter('wp_terms_checklist_args','taxonomy_checklist_checked_ontop_filter'); |
This file contains hidden or 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
SELECT t.*, tt.* FROM ss_terms AS t | |
INNER JOIN ss_term_taxonomy AS tt ON (tt.term_id = t.term_id) | |
INNER JOIN ss_term_relationships AS tr ON (tr.term_taxonomy_id = tt.term_taxonomy_id) | |
WHERE tt.taxonomy IN ('taxonomy') AND tr.object_id IN (136) | |
ORDER BY t.name ASC; |
This file contains hidden or 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
console.log(JSON.stringify(data,true," ")); |
This file contains hidden or 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
var rand = function() { | |
return Math.random().toString(36).substr(2); // remove `0.` | |
}; | |
var token = function() { | |
return rand() + rand(); // to make it longer | |
}; | |
token(); // "bnh5yzdirjinqaorq0ox1tf383nb3xr" |
This file contains hidden or 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 | |
add_action('init', 'cloneRole'); | |
function cloneRole() | |
{ | |
global $wp_roles; | |
if ( ! isset( $wp_roles ) ) | |
$wp_roles = new WP_Roles(); | |
$adm = $wp_roles->get_role('administrator'); |