AMP for WP – Accelerated Mobile Pages - Version 1.0.77.51

Version Description

(9th September 2022) = * Fixed: Infinite scroll doesn't work with custom post type. #5309 * Fixed: Need to make it compatible with the Co-Authors Plus plugin #5313 * Fixed: Slide Anything image src not loading properly. #5315

Download this release

Release Info

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

Code changes from version 1.0.77.50 to 1.0.77.51

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.77.50
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.77.50');
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.51
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.51');
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,10 @@
1
  == Changelog ==
2
 
 
 
 
 
 
3
  = 1.0.77.50 (24th August 2022) =
4
  * Fixed: "Back to Top link" option adds amp-animation & amp-position-observer script without its usage on page #5305
5
  * Fixed: AMPforWP is creating "/amp" as an endpoint in Addon mode. #5303
1
  == Changelog ==
2
 
3
+ = 1.0.77.51 (9th September 2022) =
4
+ * Fixed: Infinite scroll doesn't work with custom post type. #5309
5
+ * Fixed: Need to make it compatible with the Co-Authors Plus plugin #5313
6
+ * Fixed: Slide Anything image src not loading properly. #5315
7
+
8
  = 1.0.77.50 (24th August 2022) =
9
  * Fixed: "Back to Top link" option adds amp-animation & amp-position-observer script without its usage on page #5305
10
  * Fixed: AMPforWP is creating "/amp" as an endpoint in Addon mode. #5303
classes/class-ampforwp-infinite-scroll.php CHANGED
@@ -19,7 +19,7 @@ if( ! class_exists('AMPforWP_Infinite_Scroll') ) {
19
  $this->is_single = true == $this->is_single() ? $this->is_single() : $this->is_single;
20
  $this->is_loop = true == $this->is_loop() ? $this->is_loop() : $this->is_loop;
21
  $this->paged = $this->paged();
22
- if ( $this->is_single && 'post' === get_post_type(ampforwp_get_the_ID()) ){
23
  // amp-next-page experiment meta tag
24
  add_action('amp_experiment_meta', array( $this, 'amp_experiment_meta') );
25
  // amp-next-page script
@@ -146,8 +146,8 @@ if( ! class_exists('AMPforWP_Infinite_Scroll') ) {
146
  );
147
  if (ampforwp_get_setting('ampforwp-infinite-scroll-single') && ampforwp_get_setting('ampforwp-infinite-scroll-single-category')){
148
  $categories = get_the_category($post->ID);
 
149
  if ($categories) {
150
- $category_ids = array();
151
  foreach($categories as $individual_category){
152
  $category_ids[] = $individual_category->cat_ID;
153
  }
19
  $this->is_single = true == $this->is_single() ? $this->is_single() : $this->is_single;
20
  $this->is_loop = true == $this->is_loop() ? $this->is_loop() : $this->is_loop;
21
  $this->paged = $this->paged();
22
+ if ( $this->is_single && 'page' != get_post_type(ampforwp_get_the_ID()) ){
23
  // amp-next-page experiment meta tag
24
  add_action('amp_experiment_meta', array( $this, 'amp_experiment_meta') );
25
  // amp-next-page script
146
  );
147
  if (ampforwp_get_setting('ampforwp-infinite-scroll-single') && ampforwp_get_setting('ampforwp-infinite-scroll-single-category')){
148
  $categories = get_the_category($post->ID);
149
+ $category_ids = array();
150
  if ($categories) {
 
151
  foreach($categories as $individual_category){
152
  $category_ids[] = $individual_category->cat_ID;
153
  }
components/author-box/author-box.php CHANGED
@@ -123,12 +123,18 @@ if ( isset($args['show_time']) ) {
123
  if ( true == ampforwp_get_setting('ampforwp-author-page-url') ){
124
  if ( function_exists('coauthors_posts_links') ) {
125
  if( $author_pub_name ){
126
- $auth_link = $author_link;
127
- if($is_author_link_amp==true){
128
- $auth_link = ampforwp_url_controller($author_link);
 
 
 
 
 
 
 
 
129
  }
130
- $author_link = (true == ampforwp_get_setting('ampforwp-archive-support'))? esc_url($auth_link) : esc_url($author_link);
131
- echo '<span class="author-name">' .esc_html($author_prefix) . ' <a href="'. esc_url($author_link).'" title="'. esc_html($author_name).'"> ' .esc_html( $author_name ).'</a></span>';
132
  echo ampforwp_yoast_twitter_handle();
133
  }
134
  }
123
  if ( true == ampforwp_get_setting('ampforwp-author-page-url') ){
124
  if ( function_exists('coauthors_posts_links') ) {
125
  if( $author_pub_name ){
126
+ $author_link_ = $author_link;
127
+ if($is_author_link_amp==true && ampforwp_get_setting('ampforwp-archive-support')){
128
+ $author_link_ = ampforwp_url_controller($author_link);
129
+ if($author_link_)
130
+ {
131
+ echo '<span class="author-name">' .esc_html($author_prefix) . ' <a href="'. esc_url($author_link_).'" title="'. esc_html($author_name).'"> ' .esc_html( $author_name ).'</a></span>';
132
+ }
133
+ else
134
+ {
135
+ echo $author_link; // this is html
136
+ }
137
  }
 
 
138
  echo ampforwp_yoast_twitter_handle();
139
  }
140
  }
components/components-core.php CHANGED
@@ -944,6 +944,7 @@ function ampforwp_backtotop_global_css(){?>
944
  .has-text-align-left { text-align: left;}
945
  .has-text-align-right { text-align: right;}
946
  .has-text-align-center { text-align: center;}
 
947
  <?php if (ampforwp_get_setting('ampforwp-web-push-onesignal') && ampforwp_get_setting('ampforwp-web-push-onesignal-popup') && is_single()) { ?>
948
  @media (min-width:1281px){
949
  .onesignal-popup{
944
  .has-text-align-left { text-align: left;}
945
  .has-text-align-right { text-align: right;}
946
  .has-text-align-center { text-align: center;}
947
+ .collapsible-captions amp-img img {object-fit: contain;}
948
  <?php if (ampforwp_get_setting('ampforwp-web-push-onesignal') && ampforwp_get_setting('ampforwp-web-push-onesignal-popup') && is_single()) { ?>
949
  @media (min-width:1281px){
950
  .onesignal-popup{
components/featured-image/featured-image.php CHANGED
@@ -11,10 +11,16 @@ function ampforwp_framework_get_featured_image(){
11
  $caption = "";
12
  $f_vid = "";
13
  $srcet = '';
 
14
  if( ampforwp_is_front_page() ){
15
  $post_id = ampforwp_get_frontpage_id();
16
  }
17
  if( true == ampforwp_has_post_thumbnail() ) {
 
 
 
 
 
18
  // Featured Video SmartMag theme Compatibility #2559
19
  if(class_exists('Bunyad') && Bunyad::posts()->meta('featured_video') ){
20
  global $wp_embed;
@@ -30,14 +36,14 @@ function ampforwp_framework_get_featured_image(){
30
  }elseif (has_post_thumbnail( $post_id ) ){
31
  $thumb_id = get_post_thumbnail_id($post_id);
32
  $post_content = $post->post_content;
33
- if ( ampforwp_webp_featured_image() && true !== apply_filters('ampforwp_allow_featured_image', false) && ( false !== strpos( $post_content, 'wp-image-' . $thumb_id ) || false !== strpos( $post_content, 'attachment_' . $thumb_id ) ) ) {
34
  return;
35
  }
36
  $image_size = ampforwp_get_setting('swift-featued-image-size');
37
  $image_size = apply_filters( 'ampforwp_featured_image_size', $image_size );
38
- $image = wp_get_attachment_image_src( $thumb_id, $image_size );
39
- $caption = get_the_post_thumbnail_caption( $post_id );
40
- $thumb_alt = get_post_meta( $thumb_id, '_wp_attachment_image_alt', true);
41
  $thumbnail_srcset = wp_get_attachment_image_srcset( $thumb_id, $image_size);
42
  if ( $thumbnail_srcset && 'full' == ampforwp_get_setting('swift-featued-image-size') ) {
43
  $srcet = $thumbnail_srcset;
11
  $caption = "";
12
  $f_vid = "";
13
  $srcet = '';
14
+ $fox_theme_thumb="true"; // Fox theme amp featured hide/show compatibility
15
  if( ampforwp_is_front_page() ){
16
  $post_id = ampforwp_get_frontpage_id();
17
  }
18
  if( true == ampforwp_has_post_thumbnail() ) {
19
+ // Fox theme amp featured hide/show compatibility
20
+ if(function_exists('fox_setup'))
21
+ {
22
+ $fox_theme_thumb=get_post_meta( $post_id, '_wi_thumbnail', true);
23
+ }
24
  // Featured Video SmartMag theme Compatibility #2559
25
  if(class_exists('Bunyad') && Bunyad::posts()->meta('featured_video') ){
26
  global $wp_embed;
36
  }elseif (has_post_thumbnail( $post_id ) ){
37
  $thumb_id = get_post_thumbnail_id($post_id);
38
  $post_content = $post->post_content;
39
+ if ( ampforwp_webp_featured_image() && true !== apply_filters('ampforwp_allow_featured_image', false) && ( false !== strpos( $post_content, 'wp-image-' . $thumb_id ) || false !== strpos( $post_content, 'attachment_' . $thumb_id )) || $fox_theme_thumb == "false" ) {
40
  return;
41
  }
42
  $image_size = ampforwp_get_setting('swift-featued-image-size');
43
  $image_size = apply_filters( 'ampforwp_featured_image_size', $image_size );
44
+ $image = wp_get_attachment_image_src( $thumb_id, $image_size );
45
+ $caption = get_the_post_thumbnail_caption( $post_id );
46
+ $thumb_alt = get_post_meta( $thumb_id, '_wp_attachment_image_alt', true);
47
  $thumbnail_srcset = wp_get_attachment_image_srcset( $thumb_id, $image_size);
48
  if ( $thumbnail_srcset && 'full' == ampforwp_get_setting('swift-featued-image-size') ) {
49
  $srcet = $thumbnail_srcset;
components/loop/loop.php CHANGED
@@ -8,6 +8,20 @@ function amp_archive_title(){
8
  $author_name = esc_attr(get_query_var('author_name'));
9
  $author = esc_attr(get_query_var('author'));
10
  $curauth = (get_query_var('author_name')) ? get_user_by('slug', $author_name) : get_userdata($author);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  if( true == ampforwp_gravatar_checker($curauth->user_email) ){
12
  $curauth_url = get_avatar_url( $curauth->user_email, array('size'=>180) );
13
  if($curauth_url){ ?>
@@ -15,6 +29,7 @@ function amp_archive_title(){
15
  <amp-img src="<?php echo esc_url($curauth_url); ?>" width="90" height="90" layout="responsive" alt="<?php echo esc_html(get_the_author()); ?>"></amp-img>
16
  </div>
17
  <?php }
 
18
  }
19
  }
20
  if ( is_archive() ) {
@@ -183,10 +198,9 @@ function call_loops_standard($data=array()){
183
  }
184
  if(is_author()){
185
  $exclude_ids = ampforwp_exclude_posts();
186
- $author = esc_attr(get_query_var( 'author_name' ));
187
- $author = get_user_by( 'slug', $author);
188
  $args = array(
189
- 'author' => $author->ID,
190
  'post_type' => 'post',
191
  'orderby' => 'date',
192
  'ignore_sticky_posts' => 1,
@@ -221,7 +235,6 @@ function call_loops_standard($data=array()){
221
  if( isset( $data['posts_per_page'] ) && $data['posts_per_page']>0 ){
222
  $args['posts_per_page'] = $data['posts_per_page'];
223
  }
224
-
225
  $filtered_args = apply_filters('ampforwp_query_args', $args);
226
  $amp_q = new WP_Query( $filtered_args );
227
 
8
  $author_name = esc_attr(get_query_var('author_name'));
9
  $author = esc_attr(get_query_var('author'));
10
  $curauth = (get_query_var('author_name')) ? get_user_by('slug', $author_name) : get_userdata($author);
11
+ //added code for guest author compatibility for plugin coauthors
12
+ if(!$curauth && function_exists('get_the_coauthor_meta') )
13
+ {
14
+ $thumb_url=ampforwp_get_coauthor_meta('avatar_url');
15
+ if($thumb_url){
16
+ $display_name=ampforwp_get_coauthor_meta('display_name');
17
+ ?>
18
+ <div class="amp-wp-content author-img">
19
+ <amp-img src="<?php echo esc_url($thumb_url); ?>" width="90" height="90" layout="responsive" alt="<?php echo esc_html($display_name); ?>"></amp-img>
20
+ </div>
21
+ <?php }
22
+
23
+ }
24
+ else{
25
  if( true == ampforwp_gravatar_checker($curauth->user_email) ){
26
  $curauth_url = get_avatar_url( $curauth->user_email, array('size'=>180) );
27
  if($curauth_url){ ?>
29
  <amp-img src="<?php echo esc_url($curauth_url); ?>" width="90" height="90" layout="responsive" alt="<?php echo esc_html(get_the_author()); ?>"></amp-img>
30
  </div>
31
  <?php }
32
+ }
33
  }
34
  }
35
  if ( is_archive() ) {
198
  }
199
  if(is_author()){
200
  $exclude_ids = ampforwp_exclude_posts();
201
+ $author_name = esc_attr(get_query_var( 'author_name' ));
 
202
  $args = array(
203
+ 'author_name' => $author_name,
204
  'post_type' => 'post',
205
  'orderby' => 'date',
206
  'ignore_sticky_posts' => 1,
235
  if( isset( $data['posts_per_page'] ) && $data['posts_per_page']>0 ){
236
  $args['posts_per_page'] = $data['posts_per_page'];
237
  }
 
238
  $filtered_args = apply_filters('ampforwp_query_args', $args);
239
  $amp_q = new WP_Query( $filtered_args );
240
 
includes/thirdparty-compatibility.php CHANGED
@@ -1327,4 +1327,63 @@ function ampforwp_jetpack_boost_compatibility(){
1327
  if (function_exists('\Automattic\Jetpack_Boost\run_jetpack_boost') && function_exists('ampforwp_is_amp_inURL') && ampforwp_is_amp_inURL($url_path)) {
1328
  remove_action( 'plugins_loaded', '\Automattic\Jetpack_Boost\run_jetpack_boost', 1 );
1329
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1330
  }
1327
  if (function_exists('\Automattic\Jetpack_Boost\run_jetpack_boost') && function_exists('ampforwp_is_amp_inURL') && ampforwp_is_amp_inURL($url_path)) {
1328
  remove_action( 'plugins_loaded', '\Automattic\Jetpack_Boost\run_jetpack_boost', 1 );
1329
  }
1330
+ }
1331
+ if(!function_exists('ampforwp_get_coauthor_id')){
1332
+ function ampforwp_get_coauthor_id()
1333
+ {
1334
+ $author_name = esc_attr(get_query_var('author_name'));
1335
+ $coauthor_id = get_the_author_meta( 'ID' );
1336
+ if(!$coauthor_id)
1337
+ {
1338
+ $coauthors = get_the_coauthor_meta('login');
1339
+ foreach($coauthors as $key=>$value)
1340
+ {
1341
+ if($value==$author_name)
1342
+ {
1343
+ $coauthor_id = $key;
1344
+ }
1345
+ }
1346
+ }
1347
+ return $coauthor_id;
1348
+ }
1349
+ }
1350
+
1351
+ if(!function_exists('ampforwp_get_coauthor_meta')){
1352
+ function ampforwp_get_coauthor_meta($meta_name=null)
1353
+ {
1354
+ if(!function_exists('get_the_coauthor_meta') || !$meta_name)
1355
+ {
1356
+ return '';
1357
+ }
1358
+ $coauthor_id = get_the_author_meta( 'ID' );
1359
+ if(!$coauthor_id)
1360
+ {
1361
+ $author_name = esc_attr(get_query_var('author_name'));
1362
+ $coauthors = get_the_coauthor_meta('login');
1363
+ foreach($coauthors as $key=>$value)
1364
+ {
1365
+ if($value==$author_name)
1366
+ {
1367
+ $coauthor_id = $key;
1368
+ }
1369
+ }
1370
+ }
1371
+ if(!$coauthor_id)
1372
+ {
1373
+ return '';
1374
+ }
1375
+ if($meta_name=='avatar_url')
1376
+ {
1377
+ $meta_value = get_avatar_url($coauthor_id,array('size'=>180));
1378
+ }
1379
+ else
1380
+ {
1381
+ $meta_value = get_the_coauthor_meta($meta_name,$coauthor_id);
1382
+ }
1383
+ if(is_array($meta_value))
1384
+ {
1385
+ $meta_value=$meta_value[$coauthor_id];
1386
+ }
1387
+ return esc_html($meta_value);
1388
+ }
1389
  }
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: 6.0
7
- Stable tag: 1.0.77.50
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -194,6 +194,11 @@ You can contact us from [here](https://ampforwp.com/contact/)
194
 
195
  == Changelog ==
196
 
 
 
 
 
 
197
  = 1.0.77.50 (24th August 2022) =
198
  * Fixed: "Back to Top link" option adds amp-animation & amp-position-observer script without its usage on page #5305
199
  * Fixed: AMPforWP is creating "/amp" as an endpoint in Addon mode. #5303
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 6.0
7
+ Stable tag: 1.0.77.51
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
194
 
195
  == Changelog ==
196
 
197
+ = 1.0.77.51 (9th September 2022) =
198
+ * Fixed: Infinite scroll doesn't work with custom post type. #5309
199
+ * Fixed: Need to make it compatible with the Co-Authors Plus plugin #5313
200
+ * Fixed: Slide Anything image src not loading properly. #5315
201
+
202
  = 1.0.77.50 (24th August 2022) =
203
  * Fixed: "Back to Top link" option adds amp-animation & amp-position-observer script without its usage on page #5305
204
  * Fixed: AMPforWP is creating "/amp" as an endpoint in Addon mode. #5303
templates/features.php CHANGED
@@ -2136,7 +2136,14 @@ function ampforwp_modify_archive_title( $title ) {
2136
  } elseif ( is_tag() ) {
2137
  $title = single_tag_title( '', false );
2138
  } elseif ( is_author() ) {
2139
- $title = '<span class="vcard">' . get_the_author() . '</span>';
 
 
 
 
 
 
 
2140
  } elseif ( is_post_type_archive() ) {
2141
  $title = post_type_archive_title( '', false );
2142
  } elseif ( is_tax() ) {
2136
  } elseif ( is_tag() ) {
2137
  $title = single_tag_title( '', false );
2138
  } elseif ( is_author() ) {
2139
+ if(!get_the_author() && function_exists('get_the_coauthor_meta'))
2140
+ {
2141
+ $title = '<span class="vcard">' . ampforwp_get_coauthor_meta('display_name') . '</span>';
2142
+ }
2143
+ else{
2144
+ $title = '<span class="vcard">' . get_the_author() . '</span>';
2145
+ }
2146
+
2147
  } elseif ( is_post_type_archive() ) {
2148
  $title = post_type_archive_title( '', false );
2149
  } elseif ( is_tax() ) {