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
#!/bin/bash | |
# Usage: ./init-plugin.sh "Hello World" | |
# Creates a subdirectory "hello-world" in the current working directory, | |
# performing substitutions on the scaffold "foo-bar" plugin at https://github.com/xwp/wp-foo-bar | |
set -e | |
if [ $# != 1 ]; then | |
echo "You must only supply one argument, the plugin name." | |
exit 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 | |
$foo_color_default = '#f00'; | |
$foo_text_default = 'Lorem'; | |
// These add_option() eliminate the need for supplying default values for settings, | |
// and it eliminates the need to supply the 2nd $default arg to get_option() | |
add_option( 'foo_color', $foo_color_default ); | |
add_option( 'foo_text', $foo_text_default ); | |
add_action( 'customize_register', function() use ( $foo_color_default, $foo_text_default ) { |
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
/*global wp */ | |
(function ( api ) { | |
/** | |
* Mark a sidebars_widgets setting as dirty. | |
* | |
* @param {wp.customize.Setting} setting | |
*/ | |
var markAddedSidebarsWidgetsAsDirty = function ( setting ) { | |
if ( 0 === setting.id.indexOf( 'sidebars_widgets[' ) ) { |
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 | |
/** | |
* Widget that takes random 0-5 seconds to save. | |
* | |
* @link https://github.com/xwp/wordpress-develop/pull/75/files | |
* @link https://core.trac.wordpress.org/ticket/31501 | |
*/ | |
add_action( 'widgets_init', function () { |
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
#!/bin/bash | |
cd $(dirname $0)/.. | |
twig_repo=https://github.com/twigphp/Twig.git | |
twig_tree=v1.18.0 | |
twig_path=www/wp-content/plugins/twig | |
if [ ! -e "$twig_path" ]; then | |
git init "$twig_path" | |
cd "$twig_path" |
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: Report fatal error at shutdown | |
* Author: Weston Ruter, XWP | |
* Description: Workaround for Query Monitor suppressing the displaying of errors. Workaround for <https://github.com/Automattic/vip-quickstart/issues/404> | |
* | |
* Installation instructions: | |
* $ cd vip-quickstart/www/wp-content/mu-plugins | |
* $ git clone https://gist.github.com/187da1b14f0149243fd0.git report-fatal-error-at-shutdown | |
* $ ln -s report-fatal-error-at-shutdown/report-fatal-error-at-shutdown.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
<?php | |
/* | |
Plugin Name: Test select[multiple] sync behavior in Widget Customizer | |
Description: Demonstration of Core issue #31885 via a widget undo/redo feature. | |
Plugin URI: https://core.trac.wordpress.org/ticket/31885 | |
Author: Weston Ruter, David Lonjon, XWP | |
Author URI: https://xwp.co/ | |
GitHub Plugin URI: https://gist.github.com/westonruter/2e56e08881ae296237ca | |
Copyright 2015 XWP.co Pty Ltd |
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 | |
add_action( 'init', function () { | |
if ( ! defined( 'MB_IN_BYTES' ) ) { | |
define( 'MB_IN_BYTES', 1024 * 1024 ); | |
}; | |
} ); |
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 WPCOM_VIP_CLI_Command extends WP_CLI_Command { | |
/** | |
* Clear all of the caches for memory management | |
*/ | |
protected function stop_the_insanity() { | |
/** |