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 | |
class CLASSNAME { | |
public function __construct() { | |
add_action( 'admin_head', array($this, 'classname_add_menu_icons_styles') ); | |
} | |
public static function classname_add_menu_icons_styles() { | |
?> | |
<style> | |
#adminmenu .menu-icon-post_type div.wp-menu-image:before { | |
content: "\f323"; |
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 | |
if($_POST['submit'] == 'Submit') { | |
//prevent injection | |
if (!isset( $_POST['contact_form_nonce'] ) || ! wp_verify_nonce( $_POST['contact_form_nonce'], 'submit_contact_form' ) ) { | |
print 'Sorry, your nonce did not verify.'; | |
exit; | |
} | |
//prevent spam | |
if(isset($_POST['foo']) && trim($_POST['foo']) != '') { | |
print 'Sorry, your submission has failed.'; |
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 | |
// Pretty print an array to browser for | |
// debug / examination purposes | |
echo '<pre>'; print_r($array); echo '</pre>'; | |
?> |
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
/** | |
* Creates options as 24 hour increments for an HTML select element | |
* | |
* @param {string} id: the element id of the select node | |
* @param {string} defaultTime: the default time at hh:mm:ss resolution for the select to display when loaded | |
*/ | |
function createHourSelect(id, defaultTime) { | |
var select = document.getElementById(id); | |
var hours = 24; | |
for(i=0; i < hours; i++) { |
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
# Create new branch | |
git checkout -b <branchname> | |
# Push branch to remote | |
git push -u origin <branchname> | |
# Merge branch back in | |
git checkout master | |
git merge <branchname> |
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 | |
$args = array( | |
'post_type' => 'post' // just query for all posts | |
); | |
$query = new WP_Query($args); // create new WP_Query object | |
if($query->have_posts()) { | |
while($query->have_posts()) { | |
$query->the_post(); |
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 i = 0; | |
var calls = {}; | |
function addCallToArray(termId) { | |
var k = 'call-' + i; | |
calls[k] = termId; | |
i++; | |
} | |
console.log(calls); |
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
// Assuming we have a jQuery ui autcomplete loaded... | |
// jQuery listener | |
$(domain).on('autocompleteclose', callback); | |
// Native listeners functionally equivalent to 'autocompleteclose' listener | |
domain.addEventListener('blur', callback); | |
domain.addEventListener('focusout', callback); | |
var ul = document.querySelector('.ui-autocomplete'); | |
ul.addEventListener('click', callback); |
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
// example data | |
var calls = { | |
matt: { | |
number: "8587645224", | |
id: "call-id-hash", | |
timestamp: "08-10-2015" | |
}, | |
mark: { | |
number: "8587645232", | |
id: "call-id-hash", |
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
// define example vars | |
var dataList = document.getElementById('suggestions'), | |
letters = 'abcdefghijklmnopqrstuvwxyz', | |
choices = letters.split(''), | |
doubled = []; | |
// doubled letters | |
for(var i in choices) { | |
var s = choices[i] + choices[i]; | |
doubled.push(s); |
OlderNewer