AMP for WP – Accelerated Mobile Pages - Version 1.0.44

Version Description

(29th April 2020) = * Fixed: Multiple issues created after the latest update of Yoast (14.0 and above) #4412

Download this release

Release Info

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

Code changes from version 1.0.43 to 1.0.44

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.4
7
- Stable tag: 1.0.43
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -194,6 +194,9 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
194
 
195
  == Changelog ==
196
 
 
 
 
197
  = 1.0.43 (28th April 2020) =
198
  * Improvement: Added option to hide category description #4388
199
  * Improvement: Added option to remove Google index on paginated pages #4372
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.4
7
+ Stable tag: 1.0.44
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.44 (29th April 2020) =
198
+ * Fixed: Multiple issues created after the latest update of Yoast (14.0 and above) #4412
199
+
200
  = 1.0.43 (28th April 2020) =
201
  * Improvement: Added option to hide category description #4388
202
  * Improvement: Added option to remove Google index on paginated pages #4372
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.43
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.43');
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.44
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.44');
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,8 @@
1
  == Changelog ==
2
 
 
 
 
3
  = 1.0.43 (28th April 2020) =
4
  * Improvement: Added option to hide category description #4388
5
  * Improvement: Added option to remove Google index on paginated pages #4372
1
  == Changelog ==
2
 
3
+ = 1.0.44 (29th April 2020) =
4
+ * Fixed: Multiple issues created after the latest update of Yoast (14.0 and above) #4412
5
+
6
  = 1.0.43 (28th April 2020) =
7
  * Improvement: Added option to hide category description #4388
8
  * Improvement: Added option to remove Google index on paginated pages #4372
includes/vendor/amp/includes/amp-post-template-actions.php CHANGED
@@ -12,7 +12,14 @@ function amp_post_template_add_title( $amp_template ) {
12
  <?php
13
  }
14
 
15
- add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
 
 
 
 
 
 
 
16
  function amp_post_template_add_canonical( $amp_template ) {
17
  ?>
18
  <link rel="canonical" href="<?php echo esc_url( apply_filters('ampforwp_modify_rel_url',$amp_template->get( 'canonical_url' ) ) ); ?>" />
12
  <?php
13
  }
14
 
15
+ if( (class_exists('Yoast\\WP\\SEO\\Integrations\\Front_End_Integration')) ){
16
+ if ('yoast' == ampforwp_get_setting('ampforwp-seo-selection') && ! is_singular() ){
17
+ add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
18
+ }
19
+ } else {
20
+ add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
21
+ }
22
+
23
  function amp_post_template_add_canonical( $amp_template ) {
24
  ?>
25
  <link rel="canonical" href="<?php echo esc_url( apply_filters('ampforwp_modify_rel_url',$amp_template->get( 'canonical_url' ) ) ); ?>" />
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.4
7
- Stable tag: 1.0.43
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -191,6 +191,9 @@ You can contact us from [here](https://ampforwp.com/contact/)
191
 
192
  == Changelog ==
193
 
 
 
 
194
  = 1.0.43 (28th April 2020) =
195
  * Improvement: Added option to hide category description #4388
196
  * Improvement: Added option to remove Google index on paginated pages #4372
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.4
7
+ Stable tag: 1.0.44
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
191
 
192
  == Changelog ==
193
 
194
+ = 1.0.44 (29th April 2020) =
195
+ * Fixed: Multiple issues created after the latest update of Yoast (14.0 and above) #4412
196
+
197
  = 1.0.43 (28th April 2020) =
198
  * Improvement: Added option to hide category description #4388
199
  * Improvement: Added option to remove Google index on paginated pages #4372
templates/features.php CHANGED
@@ -1653,7 +1653,10 @@ function ampforwp_replace_title_tags() {
1653
  if( class_exists('WPSEO_Frontend') && ('yoast' || 1) == ampforwp_get_setting('ampforwp-seo-selection') ) {
1654
  $yoast_title = $WPSEO_Frontend = $yoast_instance = '';
1655
 
1656
- $yoast_instance = new \Yoast\WP\SEO\Presentations\Indexable_Presentation();
 
 
 
1657
 
1658
  $WPSEO_Frontend = WPSEO_Frontend::get_instance();
1659
  $yoast_title = $WPSEO_Frontend->title($site_title);
@@ -4138,7 +4141,21 @@ function ampforwp_exclude_archive_args( $args ) {
4138
  return $args;
4139
  }
4140
 
4141
- add_action('amp_post_template_head','ampforwp_rel_canonical_home_archive');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4142
  function ampforwp_rel_canonical_home_archive(){
4143
  global $redux_builder_amp;
4144
  global $wp;
1653
  if( class_exists('WPSEO_Frontend') && ('yoast' || 1) == ampforwp_get_setting('ampforwp-seo-selection') ) {
1654
  $yoast_title = $WPSEO_Frontend = $yoast_instance = '';
1655
 
1656
+ if ( class_exists('Yoast\WP\SEO\Presentations\Indexable_Presentation') ) {
1657
+ $yoast_instance = new \Yoast\WP\SEO\Presentations\Indexable_Presentation();
1658
+ }
1659
+
1660
 
1661
  $WPSEO_Frontend = WPSEO_Frontend::get_instance();
1662
  $yoast_title = $WPSEO_Frontend->title($site_title);
4141
  return $args;
4142
  }
4143
 
4144
+ add_action('pre_amp_render_post', 'ampforwp_home_archive_canonical_setter');
4145
+ function ampforwp_home_archive_canonical_setter(){
4146
+ add_action('amp_post_template_head','ampforwp_rel_canonical_home_archive');
4147
+
4148
+ // Remove the canonical from the homepage if the Yoast 14 and above version is available
4149
+ // Except for the homepage
4150
+ if( class_exists('Yoast\\WP\\SEO\\Integrations\\Front_End_Integration') ) {
4151
+
4152
+ if ( ampforwp_is_home() && 'page' == get_option( 'show_on_front') ) {
4153
+ return ;
4154
+ }
4155
+ remove_action('amp_post_template_head','ampforwp_rel_canonical_home_archive');
4156
+ }
4157
+ }
4158
+
4159
  function ampforwp_rel_canonical_home_archive(){
4160
  global $redux_builder_amp;
4161
  global $wp;