View amp-content-styles-workaround.php
<?php
/**
* Plugin Name: AMP Content Styles Workaround
* Description: Temporary measure for dealing with external stylesheets and style elements in content.
* Author: Weston Ruter, XWP
*/
add_action( 'amp_init', function() {
// Version compare because this should be addressed by 1.0.
View add-notice-block-edit.js
wp.hooks.addFilter(
'blocks.BlockEdit',
'example/add-notice',
function( BlockEdit ) {
var NewBlockEdit = function( props ) {
return [
wp.element.createElement(
BlockEdit,
_.extend( {}, props, { key: 'example-original-edit' } )
)
View twentyfifteen-css-classes.txt
150 .widget
112 .widecolumn
74 .comment-content
70 .entry-title
66 .entry-content
62 .mu_register
62 .entry-summary
60 .page-content
54 .pagination
52 .social-navigation
View amp-invalid.php
<?php
/**
* Plugin Name: AMP Invalid
* Description: Do stuff that is invalid in AMP.
*/
namespace AMP_Invalid;
add_action( 'bad_amp_footer', function() {
?>
View amp-attributes-with-value-url.txt
action
action-xhr
background-audio
bookend-config-src
cite
config
content
data-dismiss-href
data-href
data-iframe-src
View try-amp-sanitizing-script.php
<?php
$scripts = array();
$styles = array();
$content = 'I am <script>not</script> evil.';
$global_args = array();
if ( ! class_exists( 'AMP_DOM_Utils' ) ) {
amp_load_classes();
View amp-wp-encoding-failure.diff
diff --git a/amp.php b/amp.php
index 449a814..731e4c6 100644
--- a/amp.php
+++ b/amp.php
@@ -283,6 +283,7 @@ function amp_render_post( $post ) {
}
$post_id = $post->ID;
+
/*
View sample-post.html
<article id="post-23812" class="post post-23812 type-post status-publish format-standard hentry category-general tag-4-9 tag-customize tag-dev-notes mentions-aquakitty mentions-dlh author-westonruter">
<div class="o2-post">
<header class="entry-header">
<div class="entry-meta">
<a href="https://profiles.wordpress.org/westonruter" class="author-avatar ">
<img src="https://gravatar.com/avatar/bb16e7904f2f335b6c9f524cc533d2d2?d=mystery" width="48" height="48" class="avatar grav-hashed" id="grav-bb16e7904f2f335b6c9f524cc533d2d2-0" scale="0">
</a>
View gist:49552860d1e57a20547bcebd090ef269
88 'sanitize_callback'
37 'permission_callback'
20 'validate_callback'
11 'wp-head-callback'
10 'auth_callback'
10 'active_callback'
8 'admin-preview-callback'
8 'admin-head-callback'
6 'render_callback'
5 'update_callback'
View get-template-include.php
<?php
// The following is copied from <https://github.com/WordPress/wordpress-develop/blob/1258d1d9d2c7bef7c18b4e3420219cfa716d0aca/src/wp-includes/template-loader.php#L49-L76>.
// @codingStandardsIgnoreStart
if ( is_embed() && $template = get_embed_template() ) :
elseif ( is_404() && $template = get_404_template() ) :
elseif ( is_search() && $template = get_search_template() ) :
elseif ( is_front_page() && $template = get_front_page_template() ) :
elseif ( is_home() && $template = get_home_template() ) :
elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) :
elseif ( is_tax() && $template = get_taxonomy_template() ) :