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 | |
/* | |
Usage: | |
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL | |
if ( !$frag->output() ) { // NOTE, testing for a return of false | |
functions_that_do_stuff_live(); | |
these_should_echo(); | |
// IMPORTANT | |
$frag->store(); | |
// YOU CANNOT FORGET THIS. If you do, the site will break. |
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 ajx_sharpen_resized_files( $resized_file ) { | |
$image = wp_load_image( $resized_file ); | |
if ( !is_resource( $image ) ) | |
return new WP_Error( 'error_loading_image', $image, $file ); | |
$size = @getimagesize( $resized_file ); | |
if ( !$size ) | |
return new WP_Error('invalid_image', __('Could not read image size'), $file); | |
list($orig_w, $orig_h, $orig_type) = $size; |
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: Installed Plugin Details | |
* Description: Show a "Details" link for installed plugins to view information from the WordPress.org plugin directory. | |
* Version: 1.0.0 | |
* Author: Blazer Six | |
* Author URI: http://www.blazersix.com/ | |
* License: GPL-2.0+ | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
* |
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 | |
/** | |
* How to integrate WordPress Core updates with your custom Plugin or Theme | |
* | |
* Filter the `update_plugins` transient to report your plugin as out of date. | |
* Themes have a similar transient you can filter. | |
*/ | |
add_filter( 'site_transient_update_plugins', 'wprp_extend_filter_update_plugins' ); | |
add_filter( 'transient_update_plugins', 'wprp_extend_filter_update_plugins' ); | |
function wprp_extend_filter_update_plugins( $update_plugins ) { |
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
# The following code and the code generated art works are the intellectrual properities of Hailei Wang. | |
# © 2009 - 2014, Hailei Wang. All rights reserved. | |
from nodebox import geo | |
colors = ximport("colors") | |
# Define Brush | |
def composeimage( x, y, colr, radius, points, diminish ) : | |
nofill() | |
stroke() |
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 | |
$cmb->add_field( array( | |
'name' => __( 'Postive numbers', 'theme-domain' ), | |
'desc' => __( 'Numbers only', 'msft-newscenter' ), | |
'id' => $prefix . 'number', | |
'type' => 'text', | |
'attributes' => array( | |
'type' => 'number', | |
'pattern' => '\d*', |
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 | |
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 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
<!doctype html> | |
<html> | |
<head> | |
<style> | |
body{ | |
background-color: #dfdfdf; | |
} | |
.box { | |
display: block; | |
width: 800px; |
OlderNewer