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 | |
/** | |
* Plugin Name: Name | |
* Plugin URI: http:// | |
* Description: Description | |
* Version: 1.0.0 | |
* Author: Name | |
* Author URI: http:// | |
* License: GPL-2.0+ | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
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
function wp_api_encode_acf($data,$post,$context){ | |
$data['meta'] = array_merge($data['meta'],get_fields($post['ID'])); | |
return $data; | |
} | |
if( function_exists('get_fields') ){ | |
add_filter('json_prepare_post', 'wp_api_encode_acf', 10, 3); | |
} |
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
if(window.TouchEvent) { | |
document.addEventListener('touchmove', (event) => { | |
if(event.scale !== 1) { | |
event.preventDefault(); | |
} | |
}, false); | |
} |
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
preg_replace('/<a /','<a target="_blank" ',make_clickable(get_tweet())) |
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
//Given this HTML, here are the ways to add click events | |
<button id="specialButton">Click Here</button> | |
//traditional plain JS way | |
document.getElementById('specialButton').addEventListener('click', function(){ | |
alert('button clicked!'); | |
}); | |
//-------------------------------------- |
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 | |
######################################################## | |
### CONFIG ### | |
######################################################## | |
const YOUR_EMAIL = 'YOUREMAIL@DOMAIN.COM'; | |
//define a math problem as a field in your form to prevent spam; | |
//or use a word problem with a string as the answer, but be careful since the case and spelling of the user's answer will need to be exact | |
const ANSWER = 5; | |
######################################################## |
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
sudo chown -R www-data:www-data . | |
sudo find . -type f -exec chmod 664 {} + | |
sudo find . -type d -exec chmod 775 {} + | |
sudo chmod 660 wp-config.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
String.prototype.capitalize = function() { | |
return this.charAt(0).toUpperCase() + this.slice(1); | |
} |
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 | |
header('Content-type: application/json'); | |
// Based on http://www.ravelrumba.com/blog/json-google-spreadsheets/ | |
//######################################################### | |
$key = ''; | |
$gid = '0'; //the sheet of the spreadsheet | |
//######################################################### |
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
SELECT a.name as term_name, wp_term_taxonomy.term_id | |
FROM wp_term_taxonomy | |
JOIN | |
wp_terms a | |
ON (wp_term_taxonomy.term_id = a.term_id) | |
LEFT JOIN | |
wp_terms b | |
ON (wp_term_taxonomy.parent = b.term_id) | |
WHERE wp_term_taxonomy.taxonomy = 'newscategory' | |
GROUP BY wp_term_taxonomy.term_id |
NewerOlder