-
Notifications
You must be signed in to change notification settings - Fork 798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AMP: move checks for AMP requests later, inside modules. #11195
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6873,6 +6873,11 @@ public function implode_frontend_css( $travis_test = false ) { | |
$do_implode = false; | ||
} | ||
|
||
// Do not implode CSS when the page loads via the AMP plugin. | ||
if ( Jetpack_AMP_Support::is_amp_request() ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 This call is made during |
||
$do_implode = false; | ||
} | ||
|
||
/** | ||
* Allow CSS to be concatenated into a single jetpack.css file. | ||
* | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -40,6 +40,10 @@ private function __construct() { | |||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
if ( Jetpack_AMP_Support::is_amp_request() ) { | ||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 This is works because jetpack/modules/lazy-images.php Lines 29 to 40 in cb4dcbb
It might be a good idea to mention AMP as being the reason for the |
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
add_action( 'wp_head', array( $this, 'setup_filters' ), 9999 ); // we don't really want to modify anything in <head> since it's mostly all metadata | ||||||||||||||||||||||||||
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_assets' ) ); | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
@@ -102,11 +106,6 @@ public function add_image_placeholders( $content ) { | |||||||||||||||||||||||||
return $content; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
// Don't lazyload for amp-wp content | ||||||||||||||||||||||||||
if ( Jetpack_AMP_Support::is_amp_request() ) { | ||||||||||||||||||||||||||
return $content; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
// This is a pretty simple regex, but it works | ||||||||||||||||||||||||||
$content = preg_replace_callback( '#<(img)([^>]+?)(>(.*?)</\\1>|[\/]?>)#si', array( __CLASS__, 'process_image' ), $content ); | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
@@ -340,9 +339,6 @@ private static function build_attributes_string( $attributes ) { | |||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
public function enqueue_assets() { | ||||||||||||||||||||||||||
if ( Jetpack_AMP_Support::is_amp_request() ) { | ||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
wp_enqueue_script( | ||||||||||||||||||||||||||
'jetpack-lazy-images', | ||||||||||||||||||||||||||
Jetpack::get_file_url_for_environment( | ||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -577,6 +577,10 @@ function sharing_maybe_enqueue_scripts() { | |
} | ||
|
||
function sharing_add_footer() { | ||
if ( Jetpack_AMP_Support::is_amp_request() ) { | ||
return; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 This will work fine because it will run at the |
||
|
||
global $jetpack_sharing_counts; | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good that these are integrated with the modules they relate to.