Usage:
The default repetition count is 1000. You can pass a different iteration
wp eval-file html-api-benchmark.php
wp eval-file html-api-benchmark.php 10000
See PR WordPress/performance#1471
/*! | |
* bindAndTrigger - v0.2 - 04/30/2010 | |
* http://benalman.com/ (original v0.1 at http://gist.github.com/384866 ) | |
* http://weston.ruter.net/ (playing around with improving variable args) | |
* | |
* http://jsfiddle.net/cowboy/fJnA2/ | |
*/ | |
(function($,undefined){ | |
<?php | |
/* | |
Usage: | |
cache_fragment_output( 'unique-key', 3600, function () { | |
functions_that_do_stuff_live(); | |
these_should_echo(); | |
}); | |
*/ | |
function cache_fragment_output( $key, $ttl, $function ) { |
<?php | |
/** | |
* Plugin Name: Multisite Network Upgrade WP-CLI Command | |
* Plugin URI: https://gist.github.com/westonruter/beb6120e61e9691e88ac | |
* Author: Weston Ruter, Mo Jangda | |
* Description: From command line run <code>wp multisite-network-upgrade</code>. Script converted into WP-CLI command from Mo's <a href="https://gist.github.com/mjangda/986838">CLI script</a>. | |
* License: GPL2 | |
*/ | |
if ( ! defined( 'WP_CLI' ) || ! WP_CLI ) { |
{ | |
"premiereDate": "2016-08-08T16:00:00.000Z", | |
"votingDate": "2016-11-08T16:00:00.000Z", | |
"finaleDate": "2016-11-15T16:00:00.000Z", | |
"logo": "http://placekitten.com/200/200" | |
} |
<?php | |
function my_styles_method() { | |
wp_enqueue_style( 'custom-style', get_template_directory_uri() . '/custom-css.css' ); | |
$colors = array( | |
'headings_color' => get_theme_mod( 'wpt_heading_color' ), | |
); | |
$css_output = "{color: {$colors['headings_color']}; }"; | |
$selector = 'h1,h2,h3,h4,h5,h6'; |
<?php | |
/** | |
* Plugin Name: WPSE 282139 | |
* Plugin URI: https://wordpress.stackexchange.com/questions/282139/how-to-make-get-theme-mod-work-with-ajax-in-the-customizer-preview | |
*/ | |
add_action( 'wp_ajax_my_request', function () { | |
ob_start(); | |
echo get_theme_mod( 'position', 'top' ); |
<?php | |
function nl_amp_set_schema_type( $metadata, $post ) { | |
if ($post->post_type == 'recipe') { | |
$metadata['@type'] = 'Recipe'; | |
$metadata['name'] = $post->post_title; | |
$metadata["recipeYield"] = get_field('new_serves', $post->ID); | |
$metadata['description'] = get_field('description', $post->ID); |
<?php | |
/** | |
* AMP Disable ES Modules by Default plugin. | |
* | |
* @package AMP_Disable_ESM | |
* @author Weston Ruter | |
* @link https://gist.github.com/westonruter/279bcb54336449ce55d8887fb0fcf5b9 | |
* @license GPL-2.0-or-later | |
* | |
* @wordpress-plugin |
<?php | |
/** | |
* Register scripts with a `defer` or `async` strategy in a backwards compatible manner. | |
* | |
* From WordPress 6.3 onwards, the `wp_register_script` function accepts an `$args` array that | |
* can include a `strategy` key with a value of either `async` or `defer`. | |
* | |
* This helper function handles the backwards compatibility for older versions of WordPress. When a | |
* `strategy` key is present in the `$args` array (and is either `defer` or `async`), the |
Usage:
The default repetition count is 1000. You can pass a different iteration
wp eval-file html-api-benchmark.php
wp eval-file html-api-benchmark.php 10000
See PR WordPress/performance#1471