AMP for WP – Accelerated Mobile Pages - Version 1.0.77.1

Version Description

(19th May 2021) = * Improvements: Added a filter from which user can control Mobile redirection #4488 * Improvements: Implemented the Mobile redirection functionality using Javascript method #3844 * Improvements: Added preload to get featured image on AMP #5020 * Fixed: Debug Warning in templates/features.php #5014 * Fixed: Validation error in image lightbox for gallery #5021 * Fixed: Fatal error on AMP pages after updating WP User Avatar plugin #5029

Download this release

Release Info

Developer mohammed_kaludi
Plugin Icon 128x128 AMP for WP – Accelerated Mobile Pages
Version 1.0.77.1
Comparing to
See all releases

Code changes from version 1.0.76.17 to 1.0.77.1

README.md CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.7
7
- Stable tag: 1.0.76.17
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -193,6 +193,17 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
193
 
194
  == Changelog ==
195
 
 
 
 
 
 
 
 
 
 
 
 
196
  = 1.0.76.17 (7th May 2021) =
197
  * Improvements: Added Beaver builder Pagebuilder Support in AMP Pagebuilder Extension #5009
198
  * Fixed: Title on Static Front Page is not displaying #5007
@@ -201,19 +212,4 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
201
  * Fixed: Errors in Schema Pro FAQ #4956
202
  * Fixed: PHP Warning error when enable Breadcrumbs option #5008
203
 
204
- = 1.0.76.16 (4th May 2021) =
205
- * Fixed: Incorrent height in anchor.fm audio embed from the Pennews Theme #4576
206
- * Fixed: Slide Anything Plugin text slider not working in AMP #4999
207
- * Fixed: Backend button translation #4717
208
- * Fixed: Alignment issue with Gutenberg image block #4997
209
- * Fixed: Undefined variable $q / Attempt to read property max_num_pages on null #5004
210
-
211
- = 1.0.76.15 (28th April 2021) =
212
- * Improvements: Added an option to add one signal notification on the desktop #4377
213
- * Improvements: Added an option to set Target for CTA button in swift theme #4995
214
- * Improvements: Added an option to install PWA from options panel #4529
215
- * Improvements: Added HappyForms Compatibility Extension #5001
216
- * Fixed: Width in percentage not working for the audio from the Pennews Theme #4576
217
- * Fixed: Need to allow two attributes in input tag #4998
218
-
219
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.7
7
+ Stable tag: 1.0.77.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
193
 
194
  == Changelog ==
195
 
196
+ = 1.0.77.1 (19th May 2021) =
197
+ * Improvements: Added a filter from which user can control Mobile redirection #4488
198
+ * Improvements: Implemented the Mobile redirection functionality using Javascript method #3844
199
+ * Improvements: Added preload to get featured image on AMP #5020
200
+ * Fixed: Debug Warning in templates/features.php #5014
201
+ * Fixed: Validation error in image lightbox for gallery #5021
202
+ * Fixed: Fatal error on AMP pages after updating WP User Avatar plugin #5029
203
+
204
+ = 1.0.77 (17th May 2021) =
205
+ * Fixed: Related posts doesn't show more than 3-4 #4300
206
+
207
  = 1.0.76.17 (7th May 2021) =
208
  * Improvements: Added Beaver builder Pagebuilder Support in AMP Pagebuilder Extension #5009
209
  * Fixed: Title on Static Front Page is not displaying #5007
212
  * Fixed: Errors in Schema Pro FAQ #4956
213
  * Fixed: PHP Warning error when enable Breadcrumbs option #5008
214
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
accelerated-moblie-pages.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
- Version: 1.0.76.17
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -20,7 +20,7 @@ define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
20
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
21
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
22
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
23
- define('AMPFORWP_VERSION','1.0.76.17');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
+ Version: 1.0.77.1
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
20
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
21
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
22
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
23
+ define('AMPFORWP_VERSION','1.0.77.1');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
changelog.txt CHANGED
@@ -1,5 +1,16 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 1.0.76.17 (7th May 2021) =
4
  * Improvements: Added Beaver builder Pagebuilder Support in AMP Pagebuilder Extension #5009
5
  * Fixed: Title on Static Front Page is not displaying #5007
1
  == Changelog ==
2
 
3
+ = 1.0.77.1 (19th May 2021) =
4
+ * Improvements: Added a filter from which user can control Mobile redirection #4488
5
+ * Improvements: Implemented the Mobile redirection functionality using Javascript method #3844
6
+ * Improvements: Added preload to get featured image on AMP #5020
7
+ * Fixed: Debug Warning in templates/features.php #5014
8
+ * Fixed: Validation error in image lightbox for gallery #5021
9
+ * Fixed: Fatal error on AMP pages after updating WP User Avatar plugin #5029
10
+
11
+ = 1.0.77 (17th May 2021) =
12
+ * Fixed: Related posts doesn't show more than 3-4 #4300
13
+
14
  = 1.0.76.17 (7th May 2021) =
15
  * Improvements: Added Beaver builder Pagebuilder Support in AMP Pagebuilder Extension #5009
16
  * Fixed: Title on Static Front Page is not displaying #5007
components/author-box/author-box.php CHANGED
@@ -99,7 +99,7 @@ if ( isset($args['show_time']) ) {
99
  if( null == $author_avatar_url ){
100
  $author_avatar_url = get_avatar_url( $post_author->ID, array( 'size' => $avatar_size ) );
101
  }
102
- if(class_exists('WP_User_Avatar_Functions')){
103
  $image = get_wp_user_avatar();
104
  if (!empty($image)) {
105
  preg_match_all( '@alt="([^"]+)"@' , $image, $match );
99
  if( null == $author_avatar_url ){
100
  $author_avatar_url = get_avatar_url( $post_author->ID, array( 'size' => $avatar_size ) );
101
  }
102
+ if(class_exists('WP_User_Avatar_Functions') && defined('PPRESS_VERSION_NUMBER') && version_compare(PPRESS_VERSION_NUMBER,'3.0', '<')){
103
  $image = get_wp_user_avatar();
104
  if (!empty($image)) {
105
  preg_match_all( '@alt="([^"]+)"@' , $image, $match );
components/related-posts/related-posts.php CHANGED
@@ -18,10 +18,8 @@ function ampforwp_framework_get_related_posts($argsdata=array()){
18
  <ul class="clearfix">
19
  <?php ampforwp_related_post(); ?>
20
  <?php
21
-
22
  while( $my_query->have_posts() ) {
23
  $my_query->the_post();
24
-
25
  ?>
26
  <li class="<?php if ( has_post_thumbnail() ) { echo'has_thumbnail'; } else { echo 'no_thumbnail'; } ?>">
27
  <?php
@@ -60,7 +58,6 @@ function ampforwp_related_post_loop_query(){
60
  'fields' => 'ids',
61
  'post_type' => get_post_type($post),
62
  'posts_per_page'=> $int_number_of_related_posts,
63
- 'post__not_in' => array($post->ID),
64
  'orderby' => $orderby,
65
  'ignore_sticky_posts'=>1,
66
  'has_password' => false ,
@@ -68,9 +65,9 @@ function ampforwp_related_post_loop_query(){
68
  'no_found_rows' => true,
69
  'meta_query' => array(
70
  array(
71
- 'key' => 'ampforwp-amp-on-off',
72
- 'value' => 'default',
73
- )
74
  )
75
  );
76
  if($redux_builder_amp['ampforwp-single-select-type-of-related']==2 && 'post' == $post->post_type ){
18
  <ul class="clearfix">
19
  <?php ampforwp_related_post(); ?>
20
  <?php
 
21
  while( $my_query->have_posts() ) {
22
  $my_query->the_post();
 
23
  ?>
24
  <li class="<?php if ( has_post_thumbnail() ) { echo'has_thumbnail'; } else { echo 'no_thumbnail'; } ?>">
25
  <?php
58
  'fields' => 'ids',
59
  'post_type' => get_post_type($post),
60
  'posts_per_page'=> $int_number_of_related_posts,
 
61
  'orderby' => $orderby,
62
  'ignore_sticky_posts'=>1,
63
  'has_password' => false ,
65
  'no_found_rows' => true,
66
  'meta_query' => array(
67
  array(
68
+ 'key' => 'ampforwp-amp-on-off',
69
+ 'value' => 'default',
70
+ )
71
  )
72
  );
73
  if($redux_builder_amp['ampforwp-single-select-type-of-related']==2 && 'post' == $post->post_type ){
includes/admin-script.js CHANGED
@@ -177,9 +177,31 @@ jQuery(function($) {
177
  }
178
  });
179
 
180
- $("#ampforwp-refersh-related-post").on('click', function(){
181
- var ref_nonce = $(this).attr('data-nonce');
182
- var current_post = parseInt($(this).attr('data-id'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  var elem = document.getElementById("ref_rel_post_bar");
184
  var first_int = setInterval(first_frame, 1000);
185
  var width = current_post;
@@ -196,7 +218,8 @@ jQuery(function($) {
196
  method: 'post',
197
  data: {
198
  action: 'ampforwp_referesh_related_post',
199
- verify_nonce: ref_nonce
 
200
  },
201
  success: function(response){
202
  clearInterval(first_int);
@@ -212,11 +235,27 @@ jQuery(function($) {
212
  width++;
213
  elem.style.width = width + '%';
214
  elem.innerHTML = width * 1 + '%';
 
 
 
 
215
  }
216
  }
217
  }
218
  });
219
-
 
 
 
 
 
 
 
 
 
 
 
 
220
  });
221
  $(".redux_field_search").on( "keypress", function (evt) {
222
  //Deterime where our character code is coming from within the event
177
  }
178
  });
179
 
180
+ function ampforwp_get_cookie(cname) {
181
+ var name = cname + "=";
182
+ var ca = document.cookie.split(';');
183
+ for(var i = 0; i < ca.length; i++) {
184
+ var c = ca[i];
185
+ while (c.charAt(0) == ' ') {
186
+ c = c.substring(1);
187
+ }
188
+ if (c.indexOf(name) == 0) {
189
+ return c.substring(name.length, c.length);
190
+ }
191
+ }
192
+ return "";
193
+ }
194
+
195
+ var ref_lap = ampforwp_get_cookie('ref_lap');
196
+ if(ref_lap==''){
197
+ var ref_nonce = ampforwp_get_cookie('ref_nonce');
198
+ var current_post = ampforwp_get_cookie('current_post');
199
+ if(current_post!='' && ref_nonce!=''){
200
+ ampforwp_refresh_related_post(ref_nonce, current_post);
201
+ }
202
+ }
203
+
204
+ function ampforwp_refresh_related_post(ref_nonce='', current_post=''){
205
  var elem = document.getElementById("ref_rel_post_bar");
206
  var first_int = setInterval(first_frame, 1000);
207
  var width = current_post;
218
  method: 'post',
219
  data: {
220
  action: 'ampforwp_referesh_related_post',
221
+ verify_nonce: ref_nonce,
222
+ current_post: current_post,
223
  },
224
  success: function(response){
225
  clearInterval(first_int);
235
  width++;
236
  elem.style.width = width + '%';
237
  elem.innerHTML = width * 1 + '%';
238
+ if(width == '100'){
239
+ $('#ampforwp-refersh-related-post').remove();
240
+ $('#redux_builder_amp-ampforwp-refersh-related-post .description').html('All the posts have been refreshed successfully.');
241
+ }
242
  }
243
  }
244
  }
245
  });
246
+ setTimeout(function(){
247
+ var ref_nonce = ampforwp_get_cookie('ref_nonce');
248
+ var current_post = ampforwp_get_cookie('current_post');
249
+ if(current_post!='' && ref_nonce!='' && current_post<100){
250
+ ampforwp_refresh_related_post(ref_nonce, current_post);
251
+ }
252
+ },30000);
253
+ }
254
+
255
+ $("#ampforwp-refersh-related-post").on('click', function(){
256
+ var ref_nonce = $(this).attr('data-nonce');
257
+ var current_post = parseInt($(this).attr('data-id'));
258
+ ampforwp_refresh_related_post(ref_nonce, current_post);
259
  });
260
  $(".redux_field_search").on( "keypress", function (evt) {
261
  //Deterime where our character code is coming from within the event
includes/admin-style.css CHANGED
@@ -2164,4 +2164,16 @@ span#amp-close {
2164
  font-weight: normal;
2165
  font-size: 16px;
2166
  }
2167
-
 
 
 
 
 
 
 
 
 
 
 
 
2164
  font-weight: normal;
2165
  font-size: 16px;
2166
  }
2167
+ .redux-field-container .ref-rel-bar-cont{
2168
+ background-color:#d0d3d4;
2169
+ color: black;
2170
+ position: relative;
2171
+ top: 5px;
2172
+ border-radius: 5px;
2173
+ }
2174
+ .redux-field-container .ref-rel-post-bar{
2175
+ background-color: #4CAF50;
2176
+ text-align: center;
2177
+ color: white;
2178
+ border-radius: 5px;
2179
+ }
includes/options/admin-config.php CHANGED
@@ -2853,7 +2853,48 @@ Redux::setSection( $opt_name, array(
2853
  ),
2854
  )
2855
  );
2856
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2857
  // Hide AMP Bulk Tools
2858
  Redux::setSection( $opt_name, array(
2859
  'title' => esc_html__( 'Tools', 'accelerated-mobile-pages' ),
@@ -2919,6 +2960,18 @@ Redux::setSection( $opt_name, array(
2919
  'default' => 1,
2920
  'tooltip-subtitle' => esc_html__('Enable/Disable Query Monitor for amp when logged in as admin and Query Monitor Plugin installed', 'accelerated-mobile-pages'),
2921
  ),
 
 
 
 
 
 
 
 
 
 
 
 
2922
  )
2923
  )
2924
  );
@@ -5807,14 +5860,6 @@ if(class_exists('WPSEO_Options')){
5807
  );
5808
  }
5809
  if(!is_plugin_active( 'amp-newspaper-theme/ampforwp-custom-theme.php' ) ){
5810
- function ampforwp_get_post_percent(){
5811
- return 0;
5812
- }
5813
- $post_percent = 0;
5814
- $current_page = ampforwp_get_admin_current_page();
5815
- if($current_page=="amp_options"){
5816
- $post_percent = ampforwp_get_post_percent();
5817
- }
5818
  $single_page_options = array(
5819
  array(
5820
  'id' => 'ampforwp-single_section_1',
@@ -6599,19 +6644,6 @@ $single_page_options = array(
6599
  'default' => '7',
6600
  'required' => array('ampforwp-in-content-related-posts-days-switch', '=' , '1'),
6601
  ),
6602
- array(
6603
- 'id' => 'ampforwp-refersh-related-post',
6604
- 'type' => 'raw',
6605
- 'class' => 'hide',
6606
- 'title' => esc_html__('Refresh Related Post', 'accelerated-mobile-pages'),
6607
- 'content' => "<span class='button button-primary button-small' id='ampforwp-refersh-related-post' target='_blank' data-id='".intval($post_percent)."' data-nonce='".wp_create_nonce( 'ampforwp_refresh_related_poost')."'><i class='el el-refresh'></i> Refresh</span>
6608
- <div class='ref-rel-bar-cont'>
6609
- <div id='ref_rel_post_bar' class='ref-rel-post-bar' style='width:".intval($post_percent)."%;'>".intval($post_percent)."%</div>
6610
- </div>",
6611
- 'tooltip-subtitle' => esc_html__('If related post is not showing up properly, please refresh it and check it once again.', 'accelerated-mobile-pages'),
6612
- 'full_width' => false,
6613
- 'description' => "It will refresh only 50 records at once, please try refreshing until it will complete to 100%",
6614
- ),
6615
  $jetpack_rp,
6616
  array(
6617
  'id' => 'single-tab-2',
2853
  ),
2854
  )
2855
  );
2856
+ function ampforwp_get_post_percent(){
2857
+ $total_post = $post_count = $post_percent = '';
2858
+ $args=array(
2859
+ 'fields' => 'ids',
2860
+ 'post_type' => 'post',
2861
+ 'posts_per_page'=> 1,
2862
+ 'ignore_sticky_posts'=>1,
2863
+ 'has_password' => false ,
2864
+ 'post_status'=> 'publish',
2865
+ 'no_found_rows' => true,
2866
+ 'meta_query' => array(
2867
+ array(
2868
+ 'key' => 'ampforwp-amp-on-off',
2869
+ 'compare' => 'NOT EXISTS',
2870
+ )
2871
+ )
2872
+ );
2873
+ $my_query = new wp_query( $args );
2874
+ $post_count = $my_query->post_count;
2875
+ if ($post_count == 0) {
2876
+ return 100;
2877
+ }
2878
+ $count_posts = wp_count_posts();
2879
+ if($count_posts){
2880
+ $total_post = $count_posts->publish;
2881
+ }
2882
+ $post_count = $total_post-$post_count;
2883
+ $post_percent = ($post_count/$total_post)*100;
2884
+ $post_percent = $post_percent - 24;
2885
+ return round($post_percent);
2886
+ }
2887
+ $post_percent = 0;
2888
+ $current_page = ampforwp_get_admin_current_page();
2889
+ $refresh_btn = "";
2890
+ $refresh_text = esc_html__('All post metas are upto date.', 'accelerated-mobile-pages'); ;
2891
+ if($current_page=="amp_options"){
2892
+ $post_percent = ampforwp_get_post_percent();
2893
+ if ($post_percent != 100) {
2894
+ $refresh_btn = "<span class='button button-primary button-small' id='ampforwp-refersh-related-post' target='_blank' data-id='".intval($post_percent)."' data-nonce='".wp_create_nonce( 'ampforwp_refresh_related_poost')."'><i class='el el-refresh'></i> Refresh</span>";
2895
+ $refresh_text = esc_html__('It will refresh only 30 records at once, please try refreshing until it will complete to 100%', 'accelerated-mobile-pages');
2896
+ }
2897
+ }
2898
  // Hide AMP Bulk Tools
2899
  Redux::setSection( $opt_name, array(
2900
  'title' => esc_html__( 'Tools', 'accelerated-mobile-pages' ),
2960
  'default' => 1,
2961
  'tooltip-subtitle' => esc_html__('Enable/Disable Query Monitor for amp when logged in as admin and Query Monitor Plugin installed', 'accelerated-mobile-pages'),
2962
  ),
2963
+ array(
2964
+ 'id' => 'ampforwp-refersh-related-post',
2965
+ 'type' => 'raw',
2966
+ 'title' => esc_html__('Refresh Related Post', 'accelerated-mobile-pages'),
2967
+ 'content' => $refresh_btn /* XXS OK */."
2968
+ <div class='ref-rel-bar-cont'>
2969
+ <div id='ref_rel_post_bar' class='ref-rel-post-bar' style='width:".intval($post_percent)."%;'>".intval($post_percent)."%</div>
2970
+ </div>",
2971
+ 'tooltip-subtitle' => esc_html__('If related post is not showing up properly, please refresh it and check it once again.', 'accelerated-mobile-pages'),
2972
+ 'full_width' => false,
2973
+ 'description' => $refresh_text, /* XXS OK */
2974
+ ),
2975
  )
2976
  )
2977
  );
5860
  );
5861
  }
5862
  if(!is_plugin_active( 'amp-newspaper-theme/ampforwp-custom-theme.php' ) ){
 
 
 
 
 
 
 
 
5863
  $single_page_options = array(
5864
  array(
5865
  'id' => 'ampforwp-single_section_1',
6644
  'default' => '7',
6645
  'required' => array('ampforwp-in-content-related-posts-days-switch', '=' , '1'),
6646
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
6647
  $jetpack_rp,
6648
  array(
6649
  'id' => 'single-tab-2',
includes/redirect.php CHANGED
@@ -173,7 +173,11 @@ if(is_search() && 0 == ampforwp_get_setting('amp-redirection-search')){
173
  if(preg_match('/robots\.txt/', $this_url)){
174
  return;
175
  }
176
-
 
 
 
 
177
  // return if the current page is Feed page, as we don't need anything on feedpaged
178
  if ( is_feed() ) {
179
  return;
@@ -383,6 +387,18 @@ if(is_search() && 0 == ampforwp_get_setting('amp-redirection-search')){
383
  return true;
384
  }
385
  }
 
 
 
 
 
 
 
 
 
 
 
 
386
  // #1947 when nonamp=1 it should redirect to original link
387
  $go_to_url = "";
388
  $url = "";
173
  if(preg_match('/robots\.txt/', $this_url)){
174
  return;
175
  }
176
+ $stop_mob_redirection = false;
177
+ $stop_mob_redirection = apply_filters('ampforwp_modify_mobile_redirection',$stop_mob_redirection);
178
+ if($stop_mob_redirection === true){
179
+ return;
180
+ }
181
  // return if the current page is Feed page, as we don't need anything on feedpaged
182
  if ( is_feed() ) {
183
  return;
387
  return true;
388
  }
389
  }
390
+ if(ampforwp_is_amp_endpoint()==false && $redirectToAMP==false){
391
+ if(!isset($_GET['nonamphead']) && isset($_SESSION['nonamphead']) && in_array($url_to_redirect, $_SESSION['nonamphead'])){
392
+ return;
393
+ }
394
+ if (( ! isset($_SESSION['ampforwp_amp_mode']) || ! isset($_GET['nonamp'])) && !isset($_GET['nonamphead']) ) {
395
+ $_SESSION['ampforwp_amp_mode'] = 'mobile-on';
396
+ if ( $url_to_redirect ) { ?>
397
+ <script>if(screen.width<769){window.location = "<?php echo esc_url($url_to_redirect); ?>";}</script>
398
+ <?php }
399
+ return;
400
+ }
401
+ }
402
  // #1947 when nonamp=1 it should redirect to original link
403
  $go_to_url = "";
404
  $url = "";
includes/vendor/amp/includes/amp-post-template-actions.php CHANGED
@@ -55,6 +55,11 @@ function amp_post_template_add_cached_link($amp_template) {
55
  }
56
  ?>
57
  <link rel="preload" as="script" href="https://cdn.ampproject.org/v0.js">
 
 
 
 
 
58
  <?php
59
  $scripts = $amp_template->get( 'amp_component_scripts', array() );
60
  foreach ( $scripts as $element => $script ) :
55
  }
56
  ?>
57
  <link rel="preload" as="script" href="https://cdn.ampproject.org/v0.js">
58
+ <?php
59
+ $image = get_the_post_thumbnail_url();
60
+ if($image!=""){?>
61
+ <link rel="preload" href="<?php echo esc_url($image); ?>" as="image">
62
+ <?php } ?>
63
  <?php
64
  $scripts = $amp_template->get( 'amp_component_scripts', array() );
65
  foreach ( $scripts as $element => $script ) :
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.7
7
- Stable tag: 1.0.76.17
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -190,6 +190,17 @@ You can contact us from [here](https://ampforwp.com/contact/)
190
 
191
  == Changelog ==
192
 
 
 
 
 
 
 
 
 
 
 
 
193
  = 1.0.76.17 (7th May 2021) =
194
  * Improvements: Added Beaver builder Pagebuilder Support in AMP Pagebuilder Extension #5009
195
  * Fixed: Title on Static Front Page is not displaying #5007
@@ -198,19 +209,4 @@ You can contact us from [here](https://ampforwp.com/contact/)
198
  * Fixed: Errors in Schema Pro FAQ #4956
199
  * Fixed: PHP Warning error when enable Breadcrumbs option #5008
200
 
201
- = 1.0.76.16 (4th May 2021) =
202
- * Fixed: Incorrent height in anchor.fm audio embed from the Pennews Theme #4576
203
- * Fixed: Slide Anything Plugin text slider not working in AMP #4999
204
- * Fixed: Backend button translation #4717
205
- * Fixed: Alignment issue with Gutenberg image block #4997
206
- * Fixed: Undefined variable $q / Attempt to read property max_num_pages on null #5004
207
-
208
- = 1.0.76.15 (28th April 2021) =
209
- * Improvements: Added an option to add one signal notification on the desktop #4377
210
- * Improvements: Added an option to set Target for CTA button in swift theme #4995
211
- * Improvements: Added an option to install PWA from options panel #4529
212
- * Improvements: Added HappyForms Compatibility Extension #5001
213
- * Fixed: Width in percentage not working for the audio from the Pennews Theme #4576
214
- * Fixed: Need to allow two attributes in input tag #4998
215
-
216
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.7
7
+ Stable tag: 1.0.77.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
190
 
191
  == Changelog ==
192
 
193
+ = 1.0.77.1 (19th May 2021) =
194
+ * Improvements: Added a filter from which user can control Mobile redirection #4488
195
+ * Improvements: Implemented the Mobile redirection functionality using Javascript method #3844
196
+ * Improvements: Added preload to get featured image on AMP #5020
197
+ * Fixed: Debug Warning in templates/features.php #5014
198
+ * Fixed: Validation error in image lightbox for gallery #5021
199
+ * Fixed: Fatal error on AMP pages after updating WP User Avatar plugin #5029
200
+
201
+ = 1.0.77 (17th May 2021) =
202
+ * Fixed: Related posts doesn't show more than 3-4 #4300
203
+
204
  = 1.0.76.17 (7th May 2021) =
205
  * Improvements: Added Beaver builder Pagebuilder Support in AMP Pagebuilder Extension #5009
206
  * Fixed: Title on Static Front Page is not displaying #5007
209
  * Fixed: Errors in Schema Pro FAQ #4956
210
  * Fixed: PHP Warning error when enable Breadcrumbs option #5008
211
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
templates/design-manager/design-1/elements/related-posts.php CHANGED
@@ -47,7 +47,6 @@ if($redux_builder_amp['ampforwp-single-select-type-of-related']==2) {
47
  'fields'=>'ids',
48
  'category__in' => $category_ids,
49
  'posts_per_page' => $int_number_of_related_posts,
50
- 'post__not_in' => array($post->ID),
51
  'ignore_sticky_posts'=> 1,
52
  'has_password' => false ,
53
  'post_status' => 'publish',
@@ -55,10 +54,10 @@ if($redux_builder_amp['ampforwp-single-select-type-of-related']==2) {
55
  'no_found_rows' => true,
56
  'meta_query' => array(
57
  array(
58
- 'key' => 'ampforwp-amp-on-off',
59
- 'value' => 'default',
60
  )
61
- )
62
  );
63
  }
64
  } //end of block for categories
@@ -81,9 +80,9 @@ if($redux_builder_amp['ampforwp-single-select-type-of-related']==1) {
81
  'no_found_rows' => true,
82
  'meta_query' => array(
83
  array(
84
- 'key' => 'ampforwp-amp-on-off',
85
- 'value' => 'default',
86
- )
87
  )
88
  );
89
  }
@@ -104,7 +103,7 @@ if ( isset($redux_builder_amp['ampforwp-related-posts-days-switch']) && true ==
104
  if( isset($redux_builder_amp['ampforwp-single-related-posts-switch']) && $redux_builder_amp['ampforwp-single-related-posts-switch'] && $redux_builder_amp['ampforwp-single-select-type-of-related'] ){
105
  $args = apply_filters('ampforwp_related_posts_query_args', $args);
106
  $my_query = new wp_query( $args );
107
- if( $my_query->have_posts() ) { ?>
108
  <div class="amp-wp-content relatedpost">
109
  <div class="rp">
110
  <span><?php
@@ -115,9 +114,12 @@ if( isset($redux_builder_amp['ampforwp-single-related-posts-switch']) && $redux_
115
  }?></span>
116
  <ol class="clearfix">
117
  <?php
118
-
119
  while( $my_query->have_posts() ) {
120
- $my_query->the_post();
 
 
 
121
 
122
  $related_post_permalink = ampforwp_url_controller( get_permalink() );
123
  if ( ampforwp_get_setting('ampforwp-single-related-posts-link') ) {
47
  'fields'=>'ids',
48
  'category__in' => $category_ids,
49
  'posts_per_page' => $int_number_of_related_posts,
 
50
  'ignore_sticky_posts'=> 1,
51
  'has_password' => false ,
52
  'post_status' => 'publish',
54
  'no_found_rows' => true,
55
  'meta_query' => array(
56
  array(
57
+ 'key' => 'ampforwp-amp-on-off',
58
+ 'value' => 'default',
59
  )
60
+ )
61
  );
62
  }
63
  } //end of block for categories
80
  'no_found_rows' => true,
81
  'meta_query' => array(
82
  array(
83
+ 'key' => 'ampforwp-amp-on-off',
84
+ 'value' => 'default',
85
+ )
86
  )
87
  );
88
  }
103
  if( isset($redux_builder_amp['ampforwp-single-related-posts-switch']) && $redux_builder_amp['ampforwp-single-related-posts-switch'] && $redux_builder_amp['ampforwp-single-select-type-of-related'] ){
104
  $args = apply_filters('ampforwp_related_posts_query_args', $args);
105
  $my_query = new wp_query( $args );
106
+ if( $my_query->have_posts() ) {?>
107
  <div class="amp-wp-content relatedpost">
108
  <div class="rp">
109
  <span><?php
114
  }?></span>
115
  <ol class="clearfix">
116
  <?php
117
+ $current_id = ampforwp_get_the_ID();
118
  while( $my_query->have_posts() ) {
119
+ $my_query->the_post();
120
+ if(ampforwp_get_the_ID()==$current_id){
121
+ continue;
122
+ }
123
 
124
  $related_post_permalink = ampforwp_url_controller( get_permalink() );
125
  if ( ampforwp_get_setting('ampforwp-single-related-posts-link') ) {
templates/design-manager/design-2/elements/related-posts.php CHANGED
@@ -47,18 +47,17 @@ if($redux_builder_amp['ampforwp-single-select-type-of-related']==2){
47
  'fields'=>'ids',
48
  'category__in' => $category_ids,
49
  'posts_per_page' => $int_number_of_related_posts,
50
- 'post__not_in' => array($post->ID),
51
  'ignore_sticky_posts'=> 1,
52
  'has_password' => false ,
53
  'post_status' => 'publish',
54
  'orderby' => $orderby,
55
  'no_found_rows' => true,
56
  'meta_query' => array(
57
- array(
58
- 'key' => 'ampforwp-amp-on-off',
59
- 'value' => 'default',
60
- )
61
- )
62
  );
63
  }
64
  } //end of block for categories
@@ -80,9 +79,9 @@ if($redux_builder_amp['ampforwp-single-select-type-of-related']==1) {
80
  'no_found_rows' => true,
81
  'meta_query' => array(
82
  array(
83
- 'key' => 'ampforwp-amp-on-off',
84
- 'value' => 'default',
85
- )
86
  )
87
  );
88
  }
@@ -115,10 +114,12 @@ if( isset($redux_builder_amp['ampforwp-single-related-posts-switch']) && $redux_
115
  } ?></span>
116
  <ol class="clearfix">
117
  <?php
118
-
119
  while( $my_query->have_posts() ) {
120
  $my_query->the_post();
121
-
 
 
122
  $related_post_permalink = ampforwp_url_controller( get_permalink() );
123
  if ( ampforwp_get_setting('ampforwp-single-related-posts-link') ) {
124
  $related_post_permalink = get_permalink();
47
  'fields'=>'ids',
48
  'category__in' => $category_ids,
49
  'posts_per_page' => $int_number_of_related_posts,
 
50
  'ignore_sticky_posts'=> 1,
51
  'has_password' => false ,
52
  'post_status' => 'publish',
53
  'orderby' => $orderby,
54
  'no_found_rows' => true,
55
  'meta_query' => array(
56
+ array(
57
+ 'key' => 'ampforwp-amp-on-off',
58
+ 'value' => 'default',
59
+ )
60
+ )
61
  );
62
  }
63
  } //end of block for categories
79
  'no_found_rows' => true,
80
  'meta_query' => array(
81
  array(
82
+ 'key' => 'ampforwp-amp-on-off',
83
+ 'value' => 'default',
84
+ )
85
  )
86
  );
87
  }
114
  } ?></span>
115
  <ol class="clearfix">
116
  <?php
117
+ $current_id = ampforwp_get_the_ID();
118
  while( $my_query->have_posts() ) {
119
  $my_query->the_post();
120
+ if(ampforwp_get_the_ID()==$current_id){
121
+ continue;
122
+ }
123
  $related_post_permalink = ampforwp_url_controller( get_permalink() );
124
  if ( ampforwp_get_setting('ampforwp-single-related-posts-link') ) {
125
  $related_post_permalink = get_permalink();
templates/design-manager/design-3/elements/related-posts.php CHANGED
@@ -47,19 +47,18 @@ if(ampforwp_get_setting('ampforwp-single-select-type-of-related')==2){
47
  $args=array(
48
  'fields'=>'ids',
49
  'category__in' => $category_ids,
50
- 'posts_per_page' => $int_number_of_related_posts,
51
- 'post__not_in' => array($post->ID),
52
  'ignore_sticky_posts'=> 1,
53
  'has_password' => false ,
54
  'post_status' => 'publish',
55
  'no_found_rows' => true,
56
  'orderby' => $orderby,
57
  'meta_query' => array(
58
- array(
59
- 'key' => 'ampforwp-amp-on-off',
60
- 'value' => 'default',
61
- )
62
- )
63
  );
64
  }
65
  } //end of block for categories
@@ -117,10 +116,12 @@ if( isset($redux_builder_amp['ampforwp-single-related-posts-switch']) && $redux_
117
  } ?></span>
118
  <ol class="clearfix">
119
  <?php
120
-
121
  while( $my_query->have_posts() ) {
122
  $my_query->the_post();
123
-
 
 
124
  $related_post_permalink = "";
125
  $related_post_permalink = ampforwp_url_controller( get_permalink() );
126
  if ( ampforwp_get_setting('ampforwp-single-related-posts-link') ) {
47
  $args=array(
48
  'fields'=>'ids',
49
  'category__in' => $category_ids,
50
+ 'posts_per_page' => $int_number_of_related_posts,
 
51
  'ignore_sticky_posts'=> 1,
52
  'has_password' => false ,
53
  'post_status' => 'publish',
54
  'no_found_rows' => true,
55
  'orderby' => $orderby,
56
  'meta_query' => array(
57
+ array(
58
+ 'key' => 'ampforwp-amp-on-off',
59
+ 'value' => 'default',
60
+ )
61
+ )
62
  );
63
  }
64
  } //end of block for categories
116
  } ?></span>
117
  <ol class="clearfix">
118
  <?php
119
+ $current_id = ampforwp_get_the_ID();
120
  while( $my_query->have_posts() ) {
121
  $my_query->the_post();
122
+ if(ampforwp_get_the_ID()==$current_id){
123
+ continue;
124
+ }
125
  $related_post_permalink = "";
126
  $related_post_permalink = ampforwp_url_controller( get_permalink() );
127
  if ( ampforwp_get_setting('ampforwp-single-related-posts-link') ) {
templates/design-manager/swift/single.php CHANGED
@@ -137,10 +137,12 @@ $page = get_query_var( 'page' ); ?>
137
  <ul class="clearfix">
138
  <?php ampforwp_related_post(); ?>
139
  <?php
140
-
141
  while( $my_query->have_posts() ) {
142
  $my_query->the_post();
143
-
 
 
144
  ?>
145
  <li class="<?php if ( has_post_thumbnail() ) { echo'has_thumbnail'; } else { echo 'no_thumbnail'; } ?>">
146
  <?php if ( true == $redux_builder_amp['ampforwp-single-related-posts-image'] ) { if(ampforwp_has_post_thumbnail()){?>
@@ -192,10 +194,12 @@ do_action("ampforwp_single_design_type_handle_d1");
192
  <?php ampforwp_related_post(); ?>
193
  <ul class="clearfix">
194
  <?php
195
-
196
  while( $my_query->have_posts() ) {
197
  $my_query->the_post();
198
-
 
 
199
  ?>
200
  <li class="<?php if ( has_post_thumbnail() ) { echo'has_thumbnail'; } else { echo 'no_thumbnail'; } ?>">
201
  <?php if ( true == $redux_builder_amp['ampforwp-single-related-posts-image'] ) { if(ampforwp_has_post_thumbnail()){?>
@@ -238,10 +242,12 @@ do_action("ampforwp_single_design_type_handle_d1");
238
  <?php ampforwp_related_post(); ?>
239
  <amp-carousel height="310" layout="fixed-height" type="carousel">
240
  <?php
241
-
242
  while( $my_query->have_posts() ) {
243
  $my_query->the_post();
244
-
 
 
245
  ?>
246
  <li class="<?php if ( has_post_thumbnail() ) { echo'has_thumbnail'; } else { echo 'no_thumbnail'; } ?>">
247
  <div class="rp-slide">
@@ -424,10 +430,12 @@ do_action("ampforwp_single_design_type_handle_d1");
424
  <?php ampforwp_related_post(); ?>
425
  <ul class="clearfix">
426
  <?php
427
-
428
  while( $my_query->have_posts() ) {
429
  $my_query->the_post();
430
-
 
 
431
  ?>
432
  <li class="<?php if ( has_post_thumbnail() ) { echo'has_thumbnail'; } else { echo 'no_thumbnail'; } ?>">
433
  <?php if ( true == $redux_builder_amp['ampforwp-single-related-posts-image'] ) { ?>
137
  <ul class="clearfix">
138
  <?php ampforwp_related_post(); ?>
139
  <?php
140
+ $current_id = ampforwp_get_the_ID();
141
  while( $my_query->have_posts() ) {
142
  $my_query->the_post();
143
+ if(ampforwp_get_the_ID()==$current_id){
144
+ continue;
145
+ }
146
  ?>
147
  <li class="<?php if ( has_post_thumbnail() ) { echo'has_thumbnail'; } else { echo 'no_thumbnail'; } ?>">
148
  <?php if ( true == $redux_builder_amp['ampforwp-single-related-posts-image'] ) { if(ampforwp_has_post_thumbnail()){?>
194
  <?php ampforwp_related_post(); ?>
195
  <ul class="clearfix">
196
  <?php
197
+ $current_id = ampforwp_get_the_ID();
198
  while( $my_query->have_posts() ) {
199
  $my_query->the_post();
200
+ if(ampforwp_get_the_ID()==$current_id){
201
+ continue;
202
+ }
203
  ?>
204
  <li class="<?php if ( has_post_thumbnail() ) { echo'has_thumbnail'; } else { echo 'no_thumbnail'; } ?>">
205
  <?php if ( true == $redux_builder_amp['ampforwp-single-related-posts-image'] ) { if(ampforwp_has_post_thumbnail()){?>
242
  <?php ampforwp_related_post(); ?>
243
  <amp-carousel height="310" layout="fixed-height" type="carousel">
244
  <?php
245
+ $current_id = ampforwp_get_the_ID();
246
  while( $my_query->have_posts() ) {
247
  $my_query->the_post();
248
+ if(ampforwp_get_the_ID()==$current_id){
249
+ continue;
250
+ }
251
  ?>
252
  <li class="<?php if ( has_post_thumbnail() ) { echo'has_thumbnail'; } else { echo 'no_thumbnail'; } ?>">
253
  <div class="rp-slide">
430
  <?php ampforwp_related_post(); ?>
431
  <ul class="clearfix">
432
  <?php
433
+ $current_id = ampforwp_get_the_ID();
434
  while( $my_query->have_posts() ) {
435
  $my_query->the_post();
436
+ if(ampforwp_get_the_ID()==$current_id){
437
+ continue;
438
+ }
439
  ?>
440
  <li class="<?php if ( has_post_thumbnail() ) { echo'has_thumbnail'; } else { echo 'no_thumbnail'; } ?>">
441
  <?php if ( true == $redux_builder_amp['ampforwp-single-related-posts-image'] ) { ?>
templates/features.php CHANGED
@@ -4602,13 +4602,11 @@ function ampforwp_add_blacklist_sanitizer($data){
4602
  //Compatibility with WP User Avatar #975
4603
  function ampforwp_get_wp_user_avatar($object='',$type=''){
4604
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
4605
- if(is_plugin_active( 'wp-user-avatar/wp-user-avatar.php' )){
4606
- if(class_exists('WP_User_Avatar_Functions')){
4607
  $user_avatar_url = '';
4608
  $user_avatar_url = get_wp_user_avatar_src($object);
4609
  return $user_avatar_url;
4610
  }
4611
- }
4612
  }
4613
  add_filter('get_amp_supported_post_types','ampforwp_supported_post_types');
4614
  function ampforwp_supported_post_types($supported_types){
@@ -5537,7 +5535,7 @@ if( ! function_exists( 'ampforwp_view_amp_admin_bar' ) ) {
5537
  $current_access = current_user_can('edit_posts',$current_user );
5538
  }
5539
  // Check for Screen base, user ability to read and visibility
5540
- if ($current_access && (isset($post->ID) && current_user_can('read_post', $post->ID ))
5541
  && ( isset ( $wp_post_types[ $post->post_type ]->public ) && $wp_post_types[$post->post_type]->public )
5542
  && ( isset ( $wp_post_types[ $post->post_type ]->show_in_admin_bar ) && $wp_post_types[$post->post_type]->show_in_admin_bar ) ) {
5543
  // Check if current post type is AMPed or not
@@ -8600,6 +8598,9 @@ function ampforwp_include_required_scripts($content){
8600
  }
8601
  //OTHER COMPONENT CHECK
8602
  $other_comp_arr = array('amp-mustache'=>'amp-mustache','amp-embed'=>'amp-ad','form'=>'amp-form','amp-access'=>'amp-access','amp-fx'=>'amp-fx-collection');
 
 
 
8603
  foreach ($other_comp_arr as $key => $value) {
8604
  $ocomp = $value;
8605
  $celem = 'element';
@@ -8936,20 +8937,18 @@ function ampforwp_rank_math_external_link_newtab($content){
8936
  }
8937
  return $content;
8938
  }
8939
- /* add_action( 'wp_ajax_ampforwp_referesh_related_post', 'ampforwp_referesh_related_post' );
8940
  function ampforwp_referesh_related_post(){
8941
  if(!wp_verify_nonce($_POST['verify_nonce'],'ampforwp_refresh_related_poost') ){
8942
  echo json_encode(array('status'=>403,'message'=>'user request is not allowed')) ;
8943
  die;
8944
  }
8945
  $orderby = 'ID';
8946
- if( true == ampforwp_get_setting('ampforwp-single-order-of-related-posts')){
8947
- $orderby = 'rand';
8948
- }
8949
  $args=array(
8950
  'fields' => 'ids',
8951
  'post_type' => 'post',
8952
- 'posts_per_page'=> '50',
8953
  'orderby' => $orderby,
8954
  'ignore_sticky_posts'=>1,
8955
  'has_password' => false ,
@@ -8967,7 +8966,7 @@ function ampforwp_referesh_related_post(){
8967
  $my_query->the_post();
8968
  update_post_meta(get_the_ID(),'ampforwp-amp-on-off','default');
8969
  }
8970
- $args=array(
8971
  'fields' => 'ids',
8972
  'post_status' => 'publish',
8973
  'ignore_sticky_posts' => true,
@@ -8984,18 +8983,10 @@ function ampforwp_referesh_related_post(){
8984
  while( $my_query->have_posts() ) {
8985
  $my_query->the_post();
8986
  update_post_meta(get_the_ID(),'ampforwp-ia-on-off','default');
8987
- }
8988
- delete_transient('ampforwp_get_not_meta_post_count');
8989
  $data['response'] = ampforwp_get_post_percent();
8990
  echo json_encode($data);
8991
  }
8992
- add_action( 'save_post', 'ampforwp_delete_refresh_related_post_trans');
8993
- function ampforwp_delete_refresh_related_post_trans(){
8994
- delete_transient('ampforwp_get_not_meta_post_count');
8995
- delete_transient('ampforwp_get_total_post_count');
8996
- }
8997
- */
8998
-
8999
 
9000
  // HIDE/SHOW TAG AND CATEGORY #4326
9001
  function ampforwp_save_taxonomy_meta($term_id){
4602
  //Compatibility with WP User Avatar #975
4603
  function ampforwp_get_wp_user_avatar($object='',$type=''){
4604
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
4605
+ if(class_exists('WP_User_Avatar_Functions') && defined('PPRESS_VERSION_NUMBER') && version_compare(PPRESS_VERSION_NUMBER,'3.0', '<')){
 
4606
  $user_avatar_url = '';
4607
  $user_avatar_url = get_wp_user_avatar_src($object);
4608
  return $user_avatar_url;
4609
  }
 
4610
  }
4611
  add_filter('get_amp_supported_post_types','ampforwp_supported_post_types');
4612
  function ampforwp_supported_post_types($supported_types){
5535
  $current_access = current_user_can('edit_posts',$current_user );
5536
  }
5537
  // Check for Screen base, user ability to read and visibility
5538
+ if ($current_access && (isset($post->ID) && $post->ID && current_user_can('read_post', $post->ID ))
5539
  && ( isset ( $wp_post_types[ $post->post_type ]->public ) && $wp_post_types[$post->post_type]->public )
5540
  && ( isset ( $wp_post_types[ $post->post_type ]->show_in_admin_bar ) && $wp_post_types[$post->post_type]->show_in_admin_bar ) ) {
5541
  // Check if current post type is AMPed or not
8598
  }
8599
  //OTHER COMPONENT CHECK
8600
  $other_comp_arr = array('amp-mustache'=>'amp-mustache','amp-embed'=>'amp-ad','form'=>'amp-form','amp-access'=>'amp-access','amp-fx'=>'amp-fx-collection');
8601
+ if (preg_match('/<amp-carousel(.*?)lightbox(.*?)>/', $content)) {
8602
+ $other_comp_arr['amp-carousel'] = 'amp-lightbox-gallery';
8603
+ }
8604
  foreach ($other_comp_arr as $key => $value) {
8605
  $ocomp = $value;
8606
  $celem = 'element';
8937
  }
8938
  return $content;
8939
  }
8940
+ add_action( 'wp_ajax_ampforwp_referesh_related_post', 'ampforwp_referesh_related_post' );
8941
  function ampforwp_referesh_related_post(){
8942
  if(!wp_verify_nonce($_POST['verify_nonce'],'ampforwp_refresh_related_poost') ){
8943
  echo json_encode(array('status'=>403,'message'=>'user request is not allowed')) ;
8944
  die;
8945
  }
8946
  $orderby = 'ID';
8947
+
 
 
8948
  $args=array(
8949
  'fields' => 'ids',
8950
  'post_type' => 'post',
8951
+ 'posts_per_page'=> 30,
8952
  'orderby' => $orderby,
8953
  'ignore_sticky_posts'=>1,
8954
  'has_password' => false ,
8966
  $my_query->the_post();
8967
  update_post_meta(get_the_ID(),'ampforwp-amp-on-off','default');
8968
  }
8969
+ /*$args=array(
8970
  'fields' => 'ids',
8971
  'post_status' => 'publish',
8972
  'ignore_sticky_posts' => true,
8983
  while( $my_query->have_posts() ) {
8984
  $my_query->the_post();
8985
  update_post_meta(get_the_ID(),'ampforwp-ia-on-off','default');
8986
+ }*/
 
8987
  $data['response'] = ampforwp_get_post_percent();
8988
  echo json_encode($data);
8989
  }
 
 
 
 
 
 
 
8990
 
8991
  // HIDE/SHOW TAG AND CATEGORY #4326
8992
  function ampforwp_save_taxonomy_meta($term_id){