ID; } if ( get_option( 'page_for_posts') == $current_page ) { return false ; } return true; } return false ; } function ampforwp_is_home(){ global $redux_builder_amp; $output = false; if ( ampforwp_is_front_page() == false && ampforwp_is_blog () == false && is_home() ) { $output = true; } return $output; } function ampforwp_is_blog(){ $get_blog_details = ""; $get_blog_details = ampforwp_get_blog_details(); return $get_blog_details ; } // Polylang frontpage function ampforwp_polylang_front_page() { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); if( is_plugin_active( 'polylang/polylang.php' ) || is_plugin_active( 'polylang-pro/polylang.php' ) ){ global $polylang; $page_id = $polylang->curlang->page_on_front; $frontpage_id = get_option('page_on_front'); // is_front_page is not working here so had to do this way // Check current page id with translated page id if ( function_exists('pll_get_post') && $page_id == pll_get_post($frontpage_id) && ! is_page() && ! is_single() && ! is_archive() && ! is_search() && ! ampforwp_is_blog() ){ return true; } } return false; } // Get The ID for AMP #2867 function ampforwp_get_the_ID($post_id=''){ $post_id = get_the_ID(); if(ampforwp_is_front_page()){ $post_id = ampforwp_get_frontpage_id(); } if(ampforwp_is_blog()){ $post_id = ampforwp_get_blog_details('id'); } return $post_id; } // 27. Clean the Defer issue // TODO : Get back to this issue. #407 function ampforwp_the_content_filter_full( $content_buffer ) { if ((!is_plugin_active('amp/amp.php') && function_exists( 'ampforwp_is_amp_endpoint' ) && ampforwp_is_amp_endpoint() ) || (function_exists('amp_activate') && function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() )) { $content_buffer = preg_replace("/' defer='defer/", "", $content_buffer); $content_buffer = preg_replace("/' defer onload='/", "", $content_buffer); $content_buffer = preg_replace("/' defer /", "", $content_buffer); $content_buffer = preg_replace("/onclick=[^>]*/", "", $content_buffer); $content_buffer = preg_replace("/<\\/?thrive_headline(.|\\s)*?>/",'',$content_buffer); // Remove Extra styling added by other Themes/ Plugins $content_buffer = preg_replace('/((.*?)<\/style>)/','',$content_buffer); $content_buffer = preg_replace('/((.*?)<\/style>)(\/\*)/','$4',$content_buffer); $content_buffer = preg_replace("/<\\/?g(.|\\s)*?>/",'',$content_buffer); $content_buffer = preg_replace('/(<[^>]+) spellcheck="false"/', '$1', $content_buffer); $content_buffer = preg_replace('/(<[^>]+) spellcheck="true"/', '$1', $content_buffer); $content_buffer = preg_replace("/about:blank/", "#", $content_buffer); $content_buffer = preg_replace("/
$1 ".$nonampCss.""; $returnData = preg_replace($re, $subst, $returnData); $returnData = preg_replace( '/<\/amp-youtube>/', '', $returnData); $returnData = preg_replace_callback( '/<\/amp-iframe>/', function($matches){ return ''; }, $returnData); break; } return $returnData; } }