Permalink
Browse files

fix for amp-pages

  • Loading branch information...
1 parent b98fb49 commit bbac792c12b7089cce7b046be33ad8ce73c53108 @futtta committed on GitHub Oct 24, 2016
Showing with 14 additions and 0 deletions.
  1. +14 −0 wp-youtube-lyte.php
View
@@ -81,6 +81,9 @@ function lyte_settings_enforcer() {
add_action('after_setup_theme','lyte_settings_enforcer');
function lyte_parse($the_content,$doExcerpt=false) {
+ /** bail if amp */
+ if ( is_amp()) { return $the_content; }
+
/** main function to parse the content, searching and replacing httpv-links */
global $lyteSettings, $toCache_index, $postID, $cachekey;
$lyteSettings['path']=plugins_url() . "/" . dirname(plugin_basename(__FILE__)) . '/lyte/';
@@ -603,6 +606,17 @@ function lyte_add_action_link($links) {
return $links;
}
+/** is_amp, but I shouldn't have to do this, should I? */
+if (!function_exists("is_amp")) {
+ function is_amp() {
+ if ((strpos($_SERVER['REQUEST_URI'],'?amp')!==false) || (strpos($_SERVER['REQUEST_URI'],'/amp/')!==false)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
+
/** hooking it all up to wordpress */
if ( is_admin() ) {
require_once(dirname(__FILE__).'/options.php');

0 comments on commit bbac792

Please sign in to comment.