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 | |
/** | |
* A simple must-use plugin for WordPress that will provide a `/feed/json` endpoint for converting RSS feeds to JSON. | |
* In the absence of any URL parameters, it will convert the main feed to JSON. If a URL is set, it will convert the | |
* feed from that URL into JSON. If a callback is set, a JSONP implementation will be returned. | |
* | |
* Note: Be sure to flush rewrite rules manually by visiting the 'General'->'Permalinks' page in the WordPress admin. If | |
* you are using this in a plugin, be sure to flush the rewrite rules on activation using the 'flush_rewrite_rules()' function. | |
* |
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 | |
/** | |
* Set a value on an multidimensional array using dot notation | |
* | |
* @param array $data | |
* @param string $key | |
* @param mixed $value | |
* | |
* @return mixed |
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 | |
function attachments_meta_box() { | |
$work_sample = new KOAO_Work_Sample( get_post() ); | |
$attachments = wp_list_pluck( $work_sample->attachments(), 'ID' ); | |
wp_enqueue_media(); | |
$js = <<<JS |
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
{ | |
"audits": [ | |
{ | |
"id": 1, | |
"facility": "ST-CD-Mbandaka", | |
"bottler": "BGI", | |
"country": "Ivory coast", | |
"businessUnit": "Central East and West Africa", | |
"bottlerGroup": "Eurasia Africa", | |
"status": "completed", |
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
// Smooth Scroll | |
$('a[href*="#"]:not([href="#"])').click(function () { | |
var target = $(this.hash); | |
if (target.length) { | |
var isInternalLink = new RegExp('/' + window.location.host + '/'); | |
if (isInternalLink.test(this.href)) { | |
$('html, body').animate({scrollTop: target.offset().top}, 1000); | |
return false; | |
} | |
} |
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( 'template_redirect', function () { | |
/** | |
* @var WP $wp | |
*/ | |
global $wp; | |
/** |
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 WP_Scholar_Defer_Scripts { | |
public static function initialize() { | |
add_filter( 'script_loader_tag', array( __CLASS__, 'defer_scripts' ), 10, 2 ); | |
add_filter( 'script_loader_tag', array( __CLASS__, 'async_scripts' ), 10, 2 ); | |
} | |
public static function defer_scripts( $tag, $handle ) { |
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 WP_Scholar_User_Registration_Field | |
*/ | |
class WP_Scholar_User_Registration_Field { | |
/** | |
* Field name | |
* |
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 | |
$cache_key = '%cache_key%'; | |
$query = get_transient( $cache_key ); | |
if ( ! $query ) { | |
$query = new WP_Query( array( | |
'post_type' => 'post', | |
'post_status' => 'publish', |
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 PostContentAppender | |
*/ | |
class PostContentAppender { | |
protected $append = ''; | |
public function __construct( $append ) { |