Skip to content

Instantly share code, notes, and snippets.

@westonruter
Last active June 29, 2019 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save westonruter/28d6e4c4810b5afff98a718fdd77210a to your computer and use it in GitHub Desktop.
Save westonruter/28d6e4c4810b5afff98a718fdd77210a to your computer and use it in GitHub Desktop.
diff --git a/public/class-sassy-social-share-public.php b/public/class-sassy-social-share-public.php
index f22bf00..25ce282 100644
--- a/public/class-sassy-social-share-public.php
+++ b/public/class-sassy-social-share-public.php
@@ -85,17 +85,13 @@ class Sassy_Social_Share_Public {
// stylesheet files for front-end of website
add_action( 'wp_enqueue_scripts', array( $this, 'frontend_css' ) );
- if ( isset( $this->options['amp_enable'] ) ) {
- $amp_options = array();
- if ( class_exists( 'AMP_Options_Manager' ) && null !== AMP_Options_Manager::OPTION_NAME ) {
- $amp_options = get_option( AMP_Options_Manager::OPTION_NAME );
- if ( isset( $amp_options['theme_support'] ) && ( $amp_options['theme_support'] == 'paired' || $amp_options['theme_support'] == 'native' ) ) {
- add_action( 'wp_print_styles', array( $this, 'frontend_amp_css' ) );
- } else {
- // stylesheet files for AMP pages
- add_action( 'amp_post_template_css', array( $this, 'frontend_amp_css' ) );
- }
- }
+ if ( isset( $this->options['amp_enable'] ) && function_exists( 'is_amp_endpoint' ) ) {
+
+ // Standard and Transitional modes.
+ add_action( 'wp_print_styles', array( $this, 'frontend_amp_css' ) );
+
+ // Reader mode.
+ add_action( 'amp_post_template_css', array( $this, 'frontend_amp_css' ) );
}
}
@@ -2046,6 +2042,9 @@ class Sassy_Social_Share_Public {
* @since 2.0
*/
public function frontend_amp_css() {
+ if ( ! is_amp_endpoint() ) {
+ return;
+ }
$css = '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment