Skip to content

Commit

Permalink
fix for amp-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
futtta committed Oct 24, 2016
1 parent b98fb49 commit bbac792
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions wp-youtube-lyte.php
Expand Up @@ -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/';
Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit bbac792

Please sign in to comment.