AMP for WP – Accelerated Mobile Pages - Version 0.9.58.1

Version Description

(9th August 2017) = * Jetpack conflict issue solved #1038 * Genesis SEO Support added #1013 * Fixed Wrong SEO title issue #1013 and #836 * Design 3 Carousel script loading method improved #990

Download this release

Release Info

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

Code changes from version 0.9.58 to 0.9.58.1

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: 0.9.58
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -18,7 +18,7 @@ define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
18
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
19
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
20
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
21
- define('AMPFORWP_VERSION','0.9.58');
22
  // any changes to AMP_QUERY_VAR should be refelected here
23
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
24
 
@@ -408,7 +408,9 @@ function ampforwp_bundle_core_amp_files(){
408
  require_once AMPFORWP_PLUGIN_DIR .'/includes/vendor/amp/amp.php';
409
 
410
  define( 'AMP__FILE__', __FILE__ );
411
- define( 'AMP__DIR__', plugin_dir_path(__FILE__) . 'includes/vendor/amp/' );
 
 
412
  define( 'AMP__VERSION', '0.4.2' );
413
 
414
  require_once( AMP__DIR__ . '/back-compat/back-compat.php' );
@@ -456,6 +458,10 @@ if ( ! function_exists('ampforwp_init') ) {
456
 
457
  define( 'AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
458
 
 
 
 
 
459
  do_action( 'amp_init' );
460
 
461
  load_plugin_textdomain( 'amp', false, plugin_basename( AMP__DIR__ ) . '/languages' );
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: 0.9.58.1
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
18
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
19
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
20
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
21
+ define('AMPFORWP_VERSION','0.9.58.1');
22
  // any changes to AMP_QUERY_VAR should be refelected here
23
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
24
 
408
  require_once AMPFORWP_PLUGIN_DIR .'/includes/vendor/amp/amp.php';
409
 
410
  define( 'AMP__FILE__', __FILE__ );
411
+ if ( ! defined('AMP__DIR__') ) {
412
+ define( 'AMP__DIR__', plugin_dir_path(__FILE__) . 'includes/vendor/amp/' );
413
+ }
414
  define( 'AMP__VERSION', '0.4.2' );
415
 
416
  require_once( AMP__DIR__ . '/back-compat/back-compat.php' );
458
 
459
  define( 'AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
460
 
461
+ if ( ! defined('AMP__DIR__') ) {
462
+ define( 'AMP__DIR__', plugin_dir_path(__FILE__) . 'includes/vendor/amp/' );
463
+ }
464
+
465
  do_action( 'amp_init' );
466
 
467
  load_plugin_textdomain( 'amp', false, plugin_basename( AMP__DIR__ ) . '/languages' );
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/5
5
  Requires at least: 3.0
6
  Tested up to: 4.8.1
7
- Stable tag: 0.9.58
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -83,6 +83,7 @@ Bug reports for AMP for WP are [welcomed on GitHub](https://github.com/ahmedkalu
83
  * Incontent & DoubleClick Support
84
  * Great Support & Active Development.
85
  * Widgets & WooCommerce
 
86
  * NEW - Facebook Instant Articles Support Added
87
 
88
  **[JOIN CHAT GROUP COMMUNITY](http://ampforwp.com/community/)**: Purpose of this group is to get proper suggestions and feedback from plugin users and the community so that we can make the plugin even better.
@@ -137,6 +138,12 @@ You can contact me using this url: http://ampforwp.com/contact/
137
 
138
  == Changelog ==
139
 
 
 
 
 
 
 
140
  = 0.9.58 (9th August 2017) =
141
  * View more details on https://ampforwp.com/new/
142
  * Genesis SEO for AMP support added
4
  Donate link: https://www.paypal.me/Kaludi/5
5
  Requires at least: 3.0
6
  Tested up to: 4.8.1
7
+ Stable tag: 0.9.58.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
83
  * Incontent & DoubleClick Support
84
  * Great Support & Active Development.
85
  * Widgets & WooCommerce
86
+ * NEW - Genesis SEO Support
87
  * NEW - Facebook Instant Articles Support Added
88
 
89
  **[JOIN CHAT GROUP COMMUNITY](http://ampforwp.com/community/)**: Purpose of this group is to get proper suggestions and feedback from plugin users and the community so that we can make the plugin even better.
138
 
139
  == Changelog ==
140
 
141
+ = 0.9.58.1 (9th August 2017) =
142
+ * Jetpack conflict issue solved #1038
143
+ * Genesis SEO Support added #1013
144
+ * Fixed Wrong SEO title issue #1013 and #836
145
+ * Design 3 Carousel script loading method improved #990
146
+
147
  = 0.9.58 (9th August 2017) =
148
  * View more details on https://ampforwp.com/new/
149
  * Genesis SEO for AMP support added
templates/design-manager/design-3/functions.php CHANGED
@@ -133,8 +133,8 @@ function ampforwp_add_design3_required_scripts( $data ) {
133
  }
134
  // Add Scripts only when Homepage AMP Featured Slider is Enabled
135
  if( is_home() ) {
136
-
137
- if ( $redux_builder_amp['amp-design-3-featured-slider'] == 1 && $redux_builder_amp['amp-design-selector'] == 3 && $redux_builder_amp['amp-frontpage-select-option'] == 0 ) {
138
 
139
  if ( empty( $data['amp_component_scripts']['amp-carousel'] ) ) {
140
  $data['amp_component_scripts']['amp-carousel'] = 'https://cdn.ampproject.org/v0/amp-carousel-0.1.js';
133
  }
134
  // Add Scripts only when Homepage AMP Featured Slider is Enabled
135
  if( is_home() ) {
136
+
137
+ if ( $redux_builder_amp['amp-design-3-featured-slider'] == 1 && $redux_builder_amp['amp-design-selector'] == 3 && $redux_builder_amp['amp-frontpage-select-option'] == 0 || get_option( 'page_for_posts' ) && get_queried_object_id() ) {
138
 
139
  if ( empty( $data['amp_component_scripts']['amp-carousel'] ) ) {
140
  $data['amp_component_scripts']['amp-carousel'] = 'https://cdn.ampproject.org/v0/amp-carousel-0.1.js';
templates/design-manager/design-3/style.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
- add_action('amp_post_template_css', 'ampforwp_additional_style_input_2');
3
- function ampforwp_additional_style_input_2( $amp_template ) {
4
  global $redux_builder_amp;
5
  $get_customizer = new AMP_Post_Template( $post_id );
6
  // Get content width
1
  <?php
2
+ add_action('amp_post_template_css', 'ampforwp_additional_style_input_3');
3
+ function ampforwp_additional_style_input_3( $amp_template ) {
4
  global $redux_builder_amp;
5
  $get_customizer = new AMP_Post_Template( $post_id );
6
  // Get content width
templates/features.php CHANGED
@@ -1629,7 +1629,7 @@ function custom_og_image_homepage() {
1629
  * 11. Added support for CPT and attachment pages.
1630
  */
1631
  //26. Extending Title Tagand De-Hooking the Standard one from AMP
1632
- add_action( 'amp_post_template_include_single', 'ampforwp_remove_title_tags' );
1633
  function ampforwp_remove_title_tags() {
1634
  return ampforwp_replace_title_tags();
1635
  }
@@ -1640,6 +1640,8 @@ function ampforwp_replace_title_tags() {
1640
 
1641
  function ampforwp_add_custom_title_tag( $title = '', $sep = '', $seplocation = '' ) {
1642
  global $redux_builder_amp;
 
 
1643
 
1644
  //* We can filter this later if needed:
1645
  $sep = ' | ';
@@ -1653,24 +1655,57 @@ function ampforwp_replace_title_tags() {
1653
  }
1654
 
1655
  if ( is_home() ) {
1656
- if ( 1 == $redux_builder_amp['amp-frontpage-select-option'] ) {
 
 
 
 
1657
  $ID = $redux_builder_amp['amp-frontpage-select-option-pages'];
1658
  $site_title = get_the_title( $ID ) . $sep . get_option( 'blogname' );
1659
- } else {
1660
- $site_title = get_bloginfo( 'name' ) . $sep . get_option( 'blogdescription' );
1661
-
1662
- $current_archive_url = home_url( $GLOBALS['wp']->request );
1663
- $current_url_in_pieces = explode( '/', $current_archive_url );
1664
- $cnt = count( $current_url_in_pieces );
1665
- if ( is_numeric( $current_url_in_pieces[ $cnt - 1 ] ) ) {
1666
- $site_title .= $sep . 'Page ' . $current_url_in_pieces[ $cnt - 1 ];
1667
- }
1668
  }
1669
  }
1670
 
1671
  if ( is_search() ) {
1672
  $site_title = $redux_builder_amp['amp-translator-search-text'] . ' ' . get_search_query();
1673
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1674
 
1675
  return esc_html( convert_chars( wptexturize( trim( $site_title ) ) ) );
1676
  }
@@ -3322,25 +3357,14 @@ function ampforwp_add_blacklist_sanitizer($data){
3322
  return $data;
3323
  }
3324
 
3325
- // Genesis SEO #1013
3326
- add_filter('wp_title', 'genesis_seo_title');
3327
- add_filter('pre_get_document_title', 'genesis_seo_title');
3328
-
3329
- function genesis_seo_title( $title ) {
3330
- if(function_exists('genesis_title')){
3331
- $genesis_title = genesis_default_title( $title );
3332
- if( $genesis_title ){
3333
- $title = $genesis_title;
3334
- }
3335
- }
3336
- return $title;
3337
- }
3338
-
3339
  //Meta description #1013
3340
  function ampforwp_generate_meta_desc(){
3341
  global $post;
3342
- //$desc = '';
3343
-
 
 
 
3344
  if($redux_builder_amp['ampforwp-seo-yoast-description']){
3345
  if ( class_exists('WPSEO_Frontend') ) {
3346
  // general Description of everywhere
@@ -3393,14 +3417,36 @@ function ampforwp_generate_meta_desc(){
3393
  }
3394
  }
3395
 
3396
- //Genesis
3397
  if(function_exists('genesis_meta')){
3398
- if(function_exists('genesis_seo_meta_description')){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3399
  $genesis_description = genesis_get_seo_meta_description();
3400
- if($genesis_description){
 
3401
  $desc = $genesis_description;
3402
  }
3403
- }
3404
  }
3405
- return $desc;
3406
- }
1629
  * 11. Added support for CPT and attachment pages.
1630
  */
1631
  //26. Extending Title Tagand De-Hooking the Standard one from AMP
1632
+ add_action( 'pre_amp_render_post', 'ampforwp_remove_title_tags');
1633
  function ampforwp_remove_title_tags() {
1634
  return ampforwp_replace_title_tags();
1635
  }
1640
 
1641
  function ampforwp_add_custom_title_tag( $title = '', $sep = '', $seplocation = '' ) {
1642
  global $redux_builder_amp;
1643
+ $site_title = '';
1644
+ $genesis_title = '';
1645
 
1646
  //* We can filter this later if needed:
1647
  $sep = ' | ';
1655
  }
1656
 
1657
  if ( is_home() ) {
1658
+ // Custom frontpage
1659
+ $site_title = get_bloginfo( 'name' ) . $sep . get_option( 'blogdescription' );
1660
+
1661
+ if( get_option( 'page_on_front' ) && $redux_builder_amp['amp-frontpage-select-option'] ){
1662
+
1663
  $ID = $redux_builder_amp['amp-frontpage-select-option-pages'];
1664
  $site_title = get_the_title( $ID ) . $sep . get_option( 'blogname' );
1665
+ }
1666
+ // Blog page
1667
+ if ( get_option( 'page_for_posts' ) && get_queried_object_id() ) {
1668
+ $ID = get_option( 'page_for_posts' );
1669
+ $site_title = get_the_title( $ID ) . $sep . get_option( 'blogname' );
 
 
 
 
1670
  }
1671
  }
1672
 
1673
  if ( is_search() ) {
1674
  $site_title = $redux_builder_amp['amp-translator-search-text'] . ' ' . get_search_query();
1675
  }
1676
+ //Genesis #1013
1677
+ if(function_exists('genesis_title')){
1678
+ if(is_home() && is_front_page() && !$redux_builder_amp['amp-frontpage-select-option']){
1679
+ // Determine the doctitle.
1680
+ $genesis_title = genesis_get_seo_option( 'home_doctitle' ) ? genesis_get_seo_option( 'home_doctitle' ) : get_bloginfo( 'name' );
1681
+
1682
+ // Append site description, if necessary.
1683
+ $genesis_title = genesis_get_seo_option( 'append_description_home' ) ? $genesis_title . " $sep " . get_bloginfo( 'description' ) : $genesis_title;
1684
+ }
1685
+ elseif ( is_home() && get_option( 'page_for_posts' ) && get_queried_object_id() )
1686
+ {
1687
+ $post_id = get_option( 'page_for_posts' );
1688
+ if ( null !== $post_id || is_singular() ) {
1689
+ if ( genesis_get_custom_field( '_genesis_title', $post_id ) ) {
1690
+ $genesis_title = genesis_get_custom_field( '_genesis_title', $post_id );
1691
+ }
1692
+ }
1693
+ }
1694
+ elseif( is_home() && get_option( 'page_on_front' ) && $redux_builder_amp['amp-frontpage-select-option'] ){
1695
+ $post_id = get_option('page_on_front');
1696
+ if ( null !== $post_id || is_singular() ) {
1697
+ if ( genesis_get_custom_field( '_genesis_title', $post_id ) ) {
1698
+ $genesis_title = genesis_get_custom_field( '_genesis_title', $post_id );
1699
+ }
1700
+ }
1701
+ }
1702
+ else {
1703
+ $genesis_title = genesis_default_title( $title );
1704
+ }
1705
+ if( $genesis_title ){
1706
+ $site_title = $genesis_title;
1707
+ }
1708
+ }
1709
 
1710
  return esc_html( convert_chars( wptexturize( trim( $site_title ) ) ) );
1711
  }
3357
  return $data;
3358
  }
3359
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3360
  //Meta description #1013
3361
  function ampforwp_generate_meta_desc(){
3362
  global $post;
3363
+ global $redux_builder_amp;
3364
+ $front = '';
3365
+ $desc = '';
3366
+ $post_id = '';
3367
+ $genesis_description = '';
3368
  if($redux_builder_amp['ampforwp-seo-yoast-description']){
3369
  if ( class_exists('WPSEO_Frontend') ) {
3370
  // general Description of everywhere
3417
  }
3418
  }
3419
 
3420
+ //Genesis #1013
3421
  if(function_exists('genesis_meta')){
3422
+ if(is_home() && is_front_page() && !$redux_builder_amp['amp-frontpage-select-option']){
3423
+ $genesis_description = genesis_get_seo_option( 'home_description' ) ? genesis_get_seo_option( 'home_description' ) : get_bloginfo( 'description' );
3424
+ }
3425
+ elseif ( is_home() && get_option( 'page_for_posts' ) && get_queried_object_id() ) {
3426
+ $post_id = get_option( 'page_for_posts' );
3427
+ if ( null !== $post_id || is_singular() ) {
3428
+ if ( genesis_get_custom_field( '_genesis_description', $post_id ) ) {
3429
+ $genesis_description = genesis_get_custom_field( '_genesis_description', $post_id );
3430
+ if($genesis_description){
3431
+ $desc = $genesis_description;
3432
+ }
3433
+ }
3434
+ }
3435
+ }
3436
+ elseif(is_home() && $redux_builder_amp['amp-frontpage-select-option'] && get_option( 'page_on_front' )){
3437
+ $post_id = get_option('page_on_front');
3438
+ if ( null !== $post_id || is_singular() ) {
3439
+ if ( genesis_get_custom_field( '_genesis_description', $post_id ) ) {
3440
+ $genesis_description = genesis_get_custom_field( '_genesis_description', $post_id );
3441
+ }
3442
+ }
3443
+ }
3444
+ else{
3445
  $genesis_description = genesis_get_seo_meta_description();
3446
+ }
3447
+ if($genesis_description){
3448
  $desc = $genesis_description;
3449
  }
 
3450
  }
3451
+ return $desc;
3452
+ }