Skip to content

Instantly share code, notes, and snippets.

Weston Ruter westonruter

Block or report user

Report or block westonruter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View wporg-themes-with-fatal-errors.txt
aperture-portfolio
arrival
arrival-me
biker
boots
childpress
chronicle
daydream
digi-store
fitness-club-lite
View add-inline-scripts.php
<?php
/**
* Plugin Name: Add Inline Scripts
* Description: Test case to debug AMP plugin source attribution problems.
* Author: Weston Ruter
* Author URI: https://weston.ruter.net/
* Plugin URI: https://amp-wp.org
* License: GPLv2 or later
*/
View enqueue-assets-with-core-dependencies.php
<?php
/**
* Plugin Name: Enqueue assets with core dependencies
* Description: Test case to debug AMP plugin source attribution problems.
* Author: Weston Ruter
* Author URI: https://weston.ruter.net/
* Plugin URI: https://amp-wp.org
* License: GPLv2 or later
*/
View add-assets-before-enqueue-scripts.php
<?php
/**
* Plugin Name: Add Assets before wp_enqueue_scripts
* Description: Test case to debug AMP plugin source attribution problems.
* Author: Weston Ruter
* Author URI: https://weston.ruter.net/
* Plugin URI: https://amp-wp.org
* License: GPLv2 or later
*/
@westonruter
westonruter / functions.php
Last active Nov 30, 2019
Forked twentytwenty template-parts/pagination.php to support amp-next-page: https://wordpress.org/support/topic/infinite-scroll-feature-in-amp/
View functions.php
<?php
// Add this code to the theme's functions.php.
add_action(
'wp_head',
static function () {
if ( mytheme_is_amp() ) {
echo '<meta name="amp-experiments-opt-in" content="amp-next-page">';
}
},
View syntax-highlighting-code-comments.php
<?php
/**
* Plugin Name: Syntax-highlighting Code Comments
* Plugin URI: https://github.com/westonruter/syntax-highlighting-code-block
* Description: Extension plugin for Syntax-highlighting Code Block to also add syntax highlighting to code in comments.
* Version: 0.1.0
* Author: Weston Ruter
* Author URI: https://weston.ruter.net/
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
View amp-spec-names.txt
a
abbr
acronym
address
amp-3d-gltf
amp-3q-player
amp-access extension .json script
amp-accordion
amp-accordion > section
amp-action-macro
View amp-validation-request-error-simulator.php
<?php
/**
* AMP Validation Request Error Simulator
*
* @package AMP_Validation_Request_Error_Simulator
* @author Weston Ruter, Google
* @license GPL-2.0-or-later
* @copyright 2019 Google Inc.
*
* @wordpress-plugin
View class-amp-base-sanitizer.php.diff
diff --git a/includes/sanitizers/class-amp-base-sanitizer.php b/includes/sanitizers/class-amp-base-sanitizer.php
index 2482db29..e2171079 100644
--- a/includes/sanitizers/class-amp-base-sanitizer.php
+++ b/includes/sanitizers/class-amp-base-sanitizer.php
@@ -486,8 +486,12 @@ abstract class AMP_Base_Sanitizer {
}
$should_remove = $this->should_sanitize_validation_error( $validation_error, compact( 'node' ) );
if ( $should_remove ) {
- $element->removeAttributeNode( $node );
- $this->clean_up_after_attribute_removal( $element, $node, $validation_error );
@westonruter
westonruter / amp-brid-player.php
Last active Oct 29, 2019
AMP Brid Player plugin for WordPress, with support for non-AMP fallback: https://github.com/ampproject/amp-wp/issues/3638
View amp-brid-player.php
<?php
/**
* AMP Brid Player
*
* Installation instructions:
* 1. Click the “Download ZIP” button.
* 2. Rename the downloaded ZIP file to “amp-brid-player.zip”
* 3. In the WordPress admin, go to Plugins > Add New
* 4. Click the Upload Plugin button.
* 5. Select the “amp-brid-player.zip” file and click “Install now”.
You can’t perform that action at this time.