Переглянути джерело

Merge branch 'master' into add/color-annotations-exford

Allan Cole 5 роки тому
батько
коміт
0a7b9c5bb3
2 змінених файлів з 17 додано та 0 видалено
  1. 1 0
      .gitignore
  2. 16 0
      dalston/functions.php

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
 node_modules
 twentynineteen/
 theme-dev-utils/
+theme-dev-utils

+ 16 - 0
dalston/functions.php

@@ -210,6 +210,11 @@ add_action( 'enqueue_block_editor_assets', 'dalston_editor_styles' );
  */
 function dalston_block_extends() {
 
+	// Bail out early while in AMP endpoint.
+	if ( dalston_is_amp() ) {
+		return;
+	}
+
 	// Cover Block Tweaks
 	wp_enqueue_script( 'dalston-extend-cover-block',
 		get_stylesheet_directory_uri() . '/block-extends/extend-cover-block.js',
@@ -241,3 +246,14 @@ function dalston_block_extends() {
 	);
 }
 add_action( 'enqueue_block_assets', 'dalston_block_extends' );
+
+/**
+ * Whether this is an AMP endpoint.
+ *
+ * @see https://github.com/Automattic/amp-wp/blob/e4472bfa5c304b6c1b968e533819e3fa96579ad4/includes/amp-helper-functions.php#L248
+ * @return bool
+ */
+function dalston_is_amp() {
+	return function_exists( 'is_amp_endpoint' ) && is_amp_endpoint();
+}
+