AMP for WP – Accelerated Mobile Pages - Version 0.9.32

Version Description

[7th Jan 2017] = * Full details at https://ampforwp.com/first-wave-of-polishing-in-2017/ * Rel=canonical issue fixed: AMP URL redirect to the normal URL #293 & #332. * Paginated pages on homepage redirect to homepage URL #335 * Title of the page should be displayed on the FrontPage #358 * Thrive Builder AMP Validation Compatibility, so it will be validated properly in AMP. * Twitter Sharing improved so it gets the data properly #341 * Option to change the number of Related Posts #290 * Validation errors due to rel="canonical" was missing on some pages * Comment button displays even if the comments are not available * Threaded comments were duplicating, so that issue is solved and added proper CSS for it. * Minor issue with Jetpack Comments fixed. * Missing amp-social-share.js on front page fixed #372 * Minor improvements to Title and description tags. * Analytics Script was loading twice when Glue was active. * Page specific class added for better customization compatibility #377 * Inline Style support added Fixed #356 * Bugs fixed in Email notification pointer

Download this release

Release Info

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

Code changes from version 0.9.31 to 0.9.32

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/5
5
  Requires at least: 3.0
6
  Tested up to: 4.7
7
- Stable tag: 0.9.31
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -70,8 +70,6 @@ Automatically add Accelerated Mobile Pages (Google AMP Project) functionality on
70
  * Incontent & DoubleClick Support
71
  * Great Support & Active Development.
72
 
73
- **NOTE:** Next Update of this plugin will be released by end of Dec 2016.
74
-
75
  **[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.
76
 
77
  = Getting Started: =
@@ -124,6 +122,25 @@ You can contact me using this url: http://ampforwp.com/contact/
124
 
125
  == Changelog ==
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  = 0.9.31 [2nd Jan 2017] =
128
  * Proper Details at https://ampforwp.com/amp-0-9-31-released-installation-user-experience/
129
  * Proper Condition added for the scripts to load in Frontpage.php
@@ -414,4 +431,4 @@ You can contact me using this url: http://ampforwp.com/contact/
414
  * Plugin URI updated
415
 
416
  = 0.1 =
417
- * Initial version
4
  Donate link: https://www.paypal.me/Kaludi/5
5
  Requires at least: 3.0
6
  Tested up to: 4.7
7
+ Stable tag: 0.9.32
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
70
  * Incontent & DoubleClick Support
71
  * Great Support & Active Development.
72
 
 
 
73
  **[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.
74
 
75
  = Getting Started: =
122
 
123
  == Changelog ==
124
 
125
+ = 0.9.32 [7th Jan 2017] =
126
+ * Full details at https://ampforwp.com/first-wave-of-polishing-in-2017/
127
+ * Rel=canonical issue fixed: AMP URL redirect to the normal URL #293 & #332.
128
+ * Paginated pages on homepage redirect to homepage URL #335
129
+ * Title of the page should be displayed on the FrontPage #358
130
+ * Thrive Builder AMP Validation Compatibility, so it will be validated properly in AMP.
131
+ * Twitter Sharing improved so it gets the data properly #341
132
+ * Option to change the number of Related Posts #290
133
+ * Validation errors due to rel="canonical" was missing on some pages
134
+ * Comment button displays even if the comments are not available
135
+ * Threaded comments were duplicating, so that issue is solved and added proper CSS for it.
136
+ * Minor issue with Jetpack Comments fixed.
137
+ * Missing amp-social-share.js on front page fixed #372
138
+ * Minor improvements to Title and description tags.
139
+ * Analytics Script was loading twice when Glue was active.
140
+ * Page specific class added for better customization compatibility #377
141
+ * Inline Style support added Fixed #356
142
+ * Bugs fixed in Email notification pointer
143
+
144
  = 0.9.31 [2nd Jan 2017] =
145
  * Proper Details at https://ampforwp.com/amp-0-9-31-released-installation-user-experience/
146
  * Proper Condition added for the scripts to load in Frontpage.php
431
  * Plugin URI updated
432
 
433
  = 0.1 =
434
+ * Initial version
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.31
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: http://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/5
@@ -26,7 +26,7 @@ add_action( 'init', 'ampforwp_add_custom_post_support',11);
26
 
27
  define('AMPFORWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
28
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
29
- define('AMPFORWP_VERSION','0.9.31');
30
 
31
  /*
32
  * Load Files only in the backend
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.32
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: http://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/5
26
 
27
  define('AMPFORWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
28
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
29
+ define('AMPFORWP_VERSION','0.9.32');
30
 
31
  /*
32
  * Load Files only in the backend
includes/newsletter.php CHANGED
@@ -6,7 +6,7 @@ class ampforwp_pointers {
6
  }
7
  function admin_enqueue_scripts () {
8
  $dismissed = explode (',', get_user_meta (wp_get_current_user ()->ID, 'dismissed_wp_pointers', true));
9
- $do_tour = !in_array ('test_wp_pointer', $dismissed);
10
  if ($do_tour) {
11
  wp_enqueue_style ('wp-pointer');
12
  wp_enqueue_script ('wp-pointer');
@@ -34,20 +34,26 @@ class ampforwp_pointers {
34
  $show_pointer = true;
35
  $file_error = true;
36
 
37
- $id = '#dashboard_right_now'; // Define ID used on page html element where we want to display pointer
38
  $content = '<h3>' . sprintf (__('You are awesome for using AMP!', 'ampforwp'), self::DISPLAY_VERSION) . '</h3>';
39
  $content .= __('<p>Do you want the latest on <b>AMP update</b> before others and some best resources on AMP in a single email? - Free just for users of AMP!</p>', 'ampforwp');
40
  $content .= __('
41
  <!-- Begin MailChimp Signup Form -->
42
  <style type="text/css">
43
- .wp-pointer-buttons{ padding:0 }
44
  .wp-pointer-content .button-secondary{ left: -25px;background: transparent;top: 5px; border: 0;position: relative; padding: 0; box-shadow: none;margin: 0;color: #bcbcbc;} .wp-pointer-content .button-primary{ display:none} #mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
45
  </style>
46
  <div id="mc_embed_signup">
47
- <form action="//ampforwp.us14.list-manage.com/subscribe/post?u=a631df13442f19caede5a5baf&amp;id=c9a71edce6" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
48
  <div id="mc_embed_signup_scroll">
49
  <div class="mc-field-group" style=" margin-left: 15px; width: 175px; float: left;">
50
- <input type="email" value="' . esc_attr( $current_user->user_email ) . '" name="EMAIL" class="required email" id="mce-EMAIL" style=" width: 168px; padding: 6px 5px;">
 
 
 
 
 
 
51
  </div>
52
  <div id="mce-responses">
53
  <div class="response" id="mce-error-response" style="display:none"></div>
@@ -61,7 +67,7 @@ class ampforwp_pointers {
61
  </div>','ampforwp');
62
  $options = array (
63
  'content' => $content,
64
- 'position' => array ('edge' => 'top', 'align' => 'left')
65
  );
66
  }
67
  if ($show_pointer) {
@@ -80,15 +86,19 @@ class ampforwp_pointers {
80
  var wp_pointers_tour_opts = <?php echo json_encode ($options); ?>, setup;
81
  wp_pointers_tour_opts = $.extend (wp_pointers_tour_opts, {
82
  buttons: function (event, t) {
83
- button = jQuery ('<a id="pointer-close" class="button-secondary">' + '<?php echo $button1; ?>' + '</a>');
 
84
  button.bind ('click.pointer', function () {
85
- t.element.pointer ('close');
86
  });
 
 
 
87
  return button;
88
  },
89
  close: function () {
90
  $.post (ajaxurl, {
91
- pointer: 'test_wp_pointer',
92
  action: 'dismiss-wp-pointer'
93
  });
94
  }
@@ -102,7 +112,7 @@ class ampforwp_pointers {
102
  });
103
  jQuery ('#pointer-close').click (function () {
104
  $.post (ajaxurl, {
105
- pointer: 'test_wp_pointer',
106
  action: 'dismiss-wp-pointer'
107
  });
108
  })
@@ -120,4 +130,4 @@ class ampforwp_pointers {
120
  }
121
  }
122
  $ampforwp_pointers = new ampforwp_pointers();
123
- ?>
6
  }
7
  function admin_enqueue_scripts () {
8
  $dismissed = explode (',', get_user_meta (wp_get_current_user ()->ID, 'dismissed_wp_pointers', true));
9
+ $do_tour = !in_array ('ampforwp_subscribe_pointer', $dismissed);
10
  if ($do_tour) {
11
  wp_enqueue_style ('wp-pointer');
12
  wp_enqueue_script ('wp-pointer');
34
  $show_pointer = true;
35
  $file_error = true;
36
 
37
+ $id = '#toplevel_page_amp_options'; // Define ID used on page html element where we want to display pointer
38
  $content = '<h3>' . sprintf (__('You are awesome for using AMP!', 'ampforwp'), self::DISPLAY_VERSION) . '</h3>';
39
  $content .= __('<p>Do you want the latest on <b>AMP update</b> before others and some best resources on AMP in a single email? - Free just for users of AMP!</p>', 'ampforwp');
40
  $content .= __('
41
  <!-- Begin MailChimp Signup Form -->
42
  <style type="text/css">
43
+ .wp-pointer-buttons{ padding:0; overflow: hidden; }
44
  .wp-pointer-content .button-secondary{ left: -25px;background: transparent;top: 5px; border: 0;position: relative; padding: 0; box-shadow: none;margin: 0;color: #bcbcbc;} .wp-pointer-content .button-primary{ display:none} #mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
45
  </style>
46
  <div id="mc_embed_signup">
47
+ <form action="//app.mailerlite.com/webforms/submit/d3w0e1" data-id="258182" data-code="d3w0e1" method="POST" target="_blank">
48
  <div id="mc_embed_signup_scroll">
49
  <div class="mc-field-group" style=" margin-left: 15px; width: 175px; float: left;">
50
+ <input type="text" name="fields[name]" class="form-control" placeholder="Name" hidden value="' . esc_attr( $current_user->display_name ) . '" style="display:none">
51
+
52
+ <input type="text" value="' . esc_attr( $current_user->user_email ) . '" name="fields[email]" class="form-control" placeholder="Email*" style=" width: 168px; padding: 6px 5px;">
53
+
54
+ <input type="text" name="fields[company]" class="form-control" placeholder="Website" hidden style=" display:none; width: 168px; padding: 6px 5px;" value="' . esc_attr( get_home_url() ) . '">
55
+
56
+ <input type="hidden" name="ml-submit" value="1" />
57
  </div>
58
  <div id="mce-responses">
59
  <div class="response" id="mce-error-response" style="display:none"></div>
67
  </div>','ampforwp');
68
  $options = array (
69
  'content' => $content,
70
+ 'position' => array ('edge' => 'left', 'align' => 'left')
71
  );
72
  }
73
  if ($show_pointer) {
86
  var wp_pointers_tour_opts = <?php echo json_encode ($options); ?>, setup;
87
  wp_pointers_tour_opts = $.extend (wp_pointers_tour_opts, {
88
  buttons: function (event, t) {
89
+ button= jQuery ('<a id="pointer-close" class="button-secondary">' + '<?php echo $button1; ?>' + '</a>');
90
+ button_2= jQuery ('#pointer-close.button');
91
  button.bind ('click.pointer', function () {
92
+ t.element.pointer ('close');
93
  });
94
+ button_2.on('click', function() {
95
+ t.element.pointer ('close');
96
+ } );
97
  return button;
98
  },
99
  close: function () {
100
  $.post (ajaxurl, {
101
+ pointer: 'ampforwp_subscribe_pointer',
102
  action: 'dismiss-wp-pointer'
103
  });
104
  }
112
  });
113
  jQuery ('#pointer-close').click (function () {
114
  $.post (ajaxurl, {
115
+ pointer: 'ampforwp_subscribe_pointer',
116
  action: 'dismiss-wp-pointer'
117
  });
118
  })
130
  }
131
  }
132
  $ampforwp_pointers = new ampforwp_pointers();
133
+ ?>
includes/options/options-init.php CHANGED
@@ -172,6 +172,7 @@
172
  'subtitle' => __('Upload a logo for the AMP version.', 'redux-framework-demo'),
173
  'desc' => __('Recommend logo size is: 190x36', 'redux-framework-demo')
174
  ),
 
175
  array(
176
  'id' => 'amp-mobile-redirection',
177
  'type' => 'switch',
@@ -243,6 +244,15 @@
243
  ),
244
  'default' => '2',
245
  ),
 
 
 
 
 
 
 
 
 
246
 
247
  // array(
248
  // 'id' => 'amp-footer-text',
@@ -291,7 +301,7 @@
291
  array(
292
  'id' =>'amp-on-off-support-for-non-amp-home-page',
293
  'type' => 'switch',
294
- 'title' => __('Non-AMP HomePage link in Header', 'redux-framework-demo'),
295
  'subtitle' => __('If you want users in header to go to non-AMP website from the Header, then you can enable this option', 'redux-framework-demo'),
296
  'default' => 0,
297
  ),
@@ -654,6 +664,14 @@ if(!is_plugin_active( 'amp-incontent-ads/amptoolkit-incontent-ads.php' ) ){
654
  ),
655
  'default' => '2',
656
  ),
 
 
 
 
 
 
 
 
657
  ),
658
 
659
  ) );
172
  'subtitle' => __('Upload a logo for the AMP version.', 'redux-framework-demo'),
173
  'desc' => __('Recommend logo size is: 190x36', 'redux-framework-demo')
174
  ),
175
+
176
  array(
177
  'id' => 'amp-mobile-redirection',
178
  'type' => 'switch',
244
  ),
245
  'default' => '2',
246
  ),
247
+ array(
248
+ 'id' => 'ampforwp-title-on-front-page',
249
+ 'type' => 'switch',
250
+ 'url' => true,
251
+ 'title' => __('Title on Static Front Page', 'redux-framework-demo'),
252
+ 'subtitle' => __('Enable/Disable display of title on the Static Front Page.', 'redux-framework-demo'),
253
+ 'default' => 0,
254
+ 'required' => array('amp-frontpage-select-option', '=' , '1'),
255
+ ),
256
 
257
  // array(
258
  // 'id' => 'amp-footer-text',
301
  array(
302
  'id' =>'amp-on-off-support-for-non-amp-home-page',
303
  'type' => 'switch',
304
+ 'title' => __('Non-AMP HomePage link in Header and Logo', 'redux-framework-demo'),
305
  'subtitle' => __('If you want users in header to go to non-AMP website from the Header, then you can enable this option', 'redux-framework-demo'),
306
  'default' => 0,
307
  ),
664
  ),
665
  'default' => '2',
666
  ),
667
+ array(
668
+ 'id' => 'ampforwp-number-of-related-posts',
669
+ 'type' => 'text',
670
+ 'title' => __('Number of Related Post', 'redux-framework-demo'),
671
+ 'subtitle' => __('Type the number of related posts you need, Eg : 2', 'redux-framework-demo'),
672
+ 'validate' => 'numeric',
673
+ 'default' => '3',
674
+ ),
675
  ),
676
 
677
  ) );
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.7
7
- Stable tag: 0.9.31
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -70,8 +70,6 @@ Automatically add Accelerated Mobile Pages (Google AMP Project) functionality on
70
  * Incontent & DoubleClick Support
71
  * Great Support & Active Development.
72
 
73
- **NOTE:** Next Update of this plugin will be released by end of Dec 2016.
74
-
75
  **[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.
76
 
77
  = Getting Started: =
@@ -124,6 +122,25 @@ You can contact me using this url: http://ampforwp.com/contact/
124
 
125
  == Changelog ==
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  = 0.9.31 [2nd Jan 2017] =
128
  * Proper Details at https://ampforwp.com/amp-0-9-31-released-installation-user-experience/
129
  * Proper Condition added for the scripts to load in Frontpage.php
4
  Donate link: https://www.paypal.me/Kaludi/5
5
  Requires at least: 3.0
6
  Tested up to: 4.7
7
+ Stable tag: 0.9.32
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
70
  * Incontent & DoubleClick Support
71
  * Great Support & Active Development.
72
 
 
 
73
  **[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.
74
 
75
  = Getting Started: =
122
 
123
  == Changelog ==
124
 
125
+ = 0.9.32 [7th Jan 2017] =
126
+ * Full details at https://ampforwp.com/first-wave-of-polishing-in-2017/
127
+ * Rel=canonical issue fixed: AMP URL redirect to the normal URL #293 & #332.
128
+ * Paginated pages on homepage redirect to homepage URL #335
129
+ * Title of the page should be displayed on the FrontPage #358
130
+ * Thrive Builder AMP Validation Compatibility, so it will be validated properly in AMP.
131
+ * Twitter Sharing improved so it gets the data properly #341
132
+ * Option to change the number of Related Posts #290
133
+ * Validation errors due to rel="canonical" was missing on some pages
134
+ * Comment button displays even if the comments are not available
135
+ * Threaded comments were duplicating, so that issue is solved and added proper CSS for it.
136
+ * Minor issue with Jetpack Comments fixed.
137
+ * Missing amp-social-share.js on front page fixed #372
138
+ * Minor improvements to Title and description tags.
139
+ * Analytics Script was loading twice when Glue was active.
140
+ * Page specific class added for better customization compatibility #377
141
+ * Inline Style support added Fixed #356
142
+ * Bugs fixed in Email notification pointer
143
+
144
  = 0.9.31 [2nd Jan 2017] =
145
  * Proper Details at https://ampforwp.com/amp-0-9-31-released-installation-user-experience/
146
  * Proper Condition added for the scripts to load in Frontpage.php
templates/custom-amp-content.php CHANGED
@@ -1,42 +1,54 @@
1
  <?php
2
  // Adding Custom meta Sanitizer to sanitize the custom content added throught tinymce post meta
3
- add_filter( 'amp_post_template_data', 'ampforwp_custom_post_content_sanitizer', 10, 2 );
4
- function ampforwp_custom_post_content_sanitizer( $data, $post ) {
5
 
6
- $amp_custom_post_content_input = get_post_meta($post->ID, 'ampforwp_custom_content_editor', true);
7
-
8
- if ( empty( $amp_custom_post_content_input ) ) {
9
- $data['ampforwp_amp_content'] = false;
10
- return $data;
11
- }
12
-
13
- $amp_custom_content = new AMP_Content( $amp_custom_post_content_input,
14
- apply_filters( 'amp_content_embed_handlers', array(
15
- 'AMP_Twitter_Embed_Handler' => array(),
16
- 'AMP_YouTube_Embed_Handler' => array(),
17
- 'AMP_Instagram_Embed_Handler' => array(),
18
- 'AMP_Vine_Embed_Handler' => array(),
19
- 'AMP_Facebook_Embed_Handler' => array(),
20
- 'AMP_Gallery_Embed_Handler' => array(),
21
- ) ),
22
- apply_filters( 'amp_content_sanitizers', array(
23
- 'AMP_Blacklist_Sanitizer' => array(),
24
- 'AMP_Img_Sanitizer' => array(),
25
- 'AMP_Video_Sanitizer' => array(),
26
- 'AMP_Audio_Sanitizer' => array(),
27
- 'AMP_Iframe_Sanitizer' => array(
28
- 'add_placeholder' => true,
29
- ),
30
- ) )
31
- );
32
-
33
- if ( $amp_custom_content ) {
34
- $data[ 'ampforwp_amp_content' ] = $amp_custom_content->get_amp_content();
35
- $data['amp_component_scripts'] = $amp_custom_content->get_amp_scripts();
36
- $data['post_amp_styles'] = $amp_custom_content->get_amp_styles();
37
- }
38
 
39
- return $data;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
 
42
 
1
  <?php
2
  // Adding Custom meta Sanitizer to sanitize the custom content added throught tinymce post meta
 
 
3
 
4
+ add_filter( 'amp_post_template_data', 'ampforwp_custom_post_content_sanitizer', 10, 2 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
+ function ampforwp_custom_post_content_sanitizer( $data, $post ) {
7
+ global $redux_builder_amp;
8
+
9
+ if( is_home() && $redux_builder_amp['amp-frontpage-select-option'] == 0 ){
10
+ return $data;
11
+ }
12
+
13
+
14
+ $amp_custom_post_content_input = get_post_meta($post->ID, 'ampforwp_custom_content_editor', true);
15
+ $amp_custom_post_content_check = get_post_meta($post->ID, 'ampforwp_custom_content_editor_checkbox', true);
16
+
17
+ if ( empty( $amp_custom_post_content_input ) ) {
18
+ $data['ampforwp_amp_content'] = false;
19
+ return $data;
20
+ }
21
+
22
+ if ( $amp_custom_post_content_check === 'yes') {
23
+
24
+ $amp_custom_content = new AMP_Content( $amp_custom_post_content_input,
25
+ apply_filters( 'amp_content_embed_handlers', array(
26
+ 'AMP_Twitter_Embed_Handler' => array(),
27
+ 'AMP_YouTube_Embed_Handler' => array(),
28
+ 'AMP_Instagram_Embed_Handler' => array(),
29
+ 'AMP_Vine_Embed_Handler' => array(),
30
+ 'AMP_Facebook_Embed_Handler' => array(),
31
+ 'AMP_Gallery_Embed_Handler' => array(),
32
+ ) ),
33
+ apply_filters( 'amp_content_sanitizers', array(
34
+ 'AMP_Blacklist_Sanitizer' => array(),
35
+ 'AMP_Img_Sanitizer' => array(),
36
+ 'AMP_Video_Sanitizer' => array(),
37
+ 'AMP_Audio_Sanitizer' => array(),
38
+ 'AMP_Iframe_Sanitizer' => array(
39
+ 'add_placeholder' => true,
40
+ ),
41
+ ) )
42
+ );
43
+
44
+ if ( $amp_custom_content ) {
45
+ $data[ 'ampforwp_amp_content' ] = $amp_custom_content->get_amp_content();
46
+ $data['amp_component_scripts'] = $amp_custom_content->get_amp_scripts();
47
+ // $data['post_amp_styles'] = $amp_custom_content->get_amp_styles();
48
+ }
49
+ }
50
+
51
+ return $data;
52
  }
53
 
54
 
templates/design-manager/design-1/elements/comments.php CHANGED
@@ -14,22 +14,18 @@
14
  <?php
15
  // Display the list of comments
16
  function ampforwp_custom_translated_comment($comment, $args, $depth){
17
- $GLOBALS['comment'] = $comment; ?>
18
- <?php if('0' === $comment->comment_parent){ ?>
 
19
  <li id="li-comment-<?php comment_ID() ?>"
20
  <?php comment_class(); ?> >
21
  <article id="comment-<?php comment_ID(); ?>" class="comment-body">
22
  <footer class="comment-meta">
23
  <div class="comment-author vcard">
24
- <?php global $redux_builder_amp;
25
  printf(__('<b class="fn">%s</b> <span class="says">'.$redux_builder_amp['amp-translator-says-text'].':</span>'), get_comment_author_link()) ?>
26
  </div>
27
  <!-- .comment-author -->
28
- <?php if ($comment->comment_approved == '0') : ?>
29
- <em><?php _e('Your comment is awaiting moderation.') ?></em>
30
- <br />
31
- <?php endif; ?>
32
- <!--comment moderation ends here-->
33
  <div class="comment-metadata">
34
  <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
35
  <?php
@@ -50,95 +46,16 @@
50
  </li>
51
  <!-- #comment-## -->
52
  <?php
53
- }else {?>
54
- <li id="li-comment-<?php comment_ID() ?>"
55
- <?php comment_class(); ?> >
56
- <article id="comment-<?php comment_ID(); ?>" class="comment-body">
57
- <footer class="comment-meta">
58
- <div class="comment-author vcard">
59
- <?php global $redux_builder_amp;
60
- printf(__('<b class="fn">%s</b> <span class="says">'.$redux_builder_amp['amp-translator-says-text'].':</span>'), get_comment_author_link()) ?>
61
- </div>
62
- <!-- .comment-author -->
63
- <?php if ($comment->comment_approved == '0') : ?>
64
- <em><?php _e('Your comment is awaiting moderation.') ?></em>
65
- <br />
66
- <?php endif; ?>
67
- <!--comment moderation ends here-->
68
- <div class="comment-metadata">
69
- <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
70
- <?php
71
- printf(__('%1$s '.$redux_builder_amp['amp-translator-at-text'].' %2$s'), get_comment_date(), get_comment_time())
72
- ?>
73
- </a>
74
- <?php edit_comment_link(__('('.$redux_builder_amp['amp-translator-Edit-text'].')'),' ','') ?>
75
- </div>
76
- <!-- .comment-metadata -->
77
- </footer>
78
- <!-- .comment-meta -->
79
- <div class="comment-content">
80
- <p><?php echo get_comment_text(); ?></p>
81
- </div>
82
- <!-- .comment-content -->
83
- <?php ampforwp_custom_translated_comment_nested($comment, $args, $depth);
84
- ?>
85
- </article>
86
- <!-- .comment-body -->
87
- </li>
88
- <!-- #comment-## -->
89
- <?php
90
- }
91
  }// end of ampforwp_custom_translated_comment()
92
 
93
- function ampforwp_custom_translated_comment_nested($comment, $args, $depth){
94
- $GLOBALS['comment'] = $comment; ?>
95
- <ul class="children">
96
- <li id="li-comment-<?php comment_ID() ?>"
97
- <?php comment_class(); ?> >
98
- <article id="comment-<?php comment_ID(); ?>" class="comment-body">
99
- <footer class="comment-meta">
100
- <div class="comment-author vcard">
101
- <?php global $redux_builder_amp;
102
- printf(__('<b class="fn">%s</b> <span class="says">'.$redux_builder_amp['amp-translator-says-text'].':</span>'), get_comment_author_link()) ?>
103
- </div>
104
- <!-- .comment-author -->
105
- <?php if ($comment->comment_approved == '0') : ?>
106
- <em><?php _e('Your comment is awaiting moderation.') ?></em>
107
- <br />
108
- <?php endif; ?>
109
- <!--comment moderation ends here-->
110
- <div class="comment-metadata">
111
- <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
112
- <?php
113
- printf(__('%1$s '.$redux_builder_amp['amp-translator-at-text'].' %2$s'), get_comment_date(), get_comment_time())
114
- ?>
115
- </a>
116
- <?php edit_comment_link(__('('.$redux_builder_amp['amp-translator-Edit-text'].')'),' ','') ?>
117
- </div>
118
- <!-- .comment-metadata -->
119
- </footer>
120
- <!-- .comment-meta -->
121
- <div class="comment-content">
122
- <p><?php echo get_comment_text(); ?></p>
123
- </div>
124
- <!-- .comment-content -->
125
- </article>
126
- <!-- .comment-body -->
127
- </li>
128
- <!-- #comment-## -->
129
- </ul>
130
- <!-- .children -->
131
- <?php
132
- }// end of ampforwp_custom_translated_comment_nested()
133
-
134
  wp_list_comments( array(
135
  'per_page' => 10, //Allow comment pagination
136
  'style' => 'li',
137
  'type' => 'comment',
138
- 'max_depth' => 0,
139
  'avatar_size' => 0,
140
  'callback' => 'ampforwp_custom_translated_comment',
141
- 'reverse_top_level' => false //Show the latest comments at the top of the list
142
  ), $comments); ?>
143
  </ul>
144
  </div>
14
  <?php
15
  // Display the list of comments
16
  function ampforwp_custom_translated_comment($comment, $args, $depth){
17
+ $GLOBALS['comment'] = $comment;
18
+ global $redux_builder_amp;
19
+ ?>
20
  <li id="li-comment-<?php comment_ID() ?>"
21
  <?php comment_class(); ?> >
22
  <article id="comment-<?php comment_ID(); ?>" class="comment-body">
23
  <footer class="comment-meta">
24
  <div class="comment-author vcard">
25
+ <?php
26
  printf(__('<b class="fn">%s</b> <span class="says">'.$redux_builder_amp['amp-translator-says-text'].':</span>'), get_comment_author_link()) ?>
27
  </div>
28
  <!-- .comment-author -->
 
 
 
 
 
29
  <div class="comment-metadata">
30
  <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
31
  <?php
46
  </li>
47
  <!-- #comment-## -->
48
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }// end of ampforwp_custom_translated_comment()
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  wp_list_comments( array(
52
  'per_page' => 10, //Allow comment pagination
53
  'style' => 'li',
54
  'type' => 'comment',
55
+ 'max_depth' => 5,
56
  'avatar_size' => 0,
57
  'callback' => 'ampforwp_custom_translated_comment',
58
+ 'reverse_top_level' => true //Show the latest comments at the top of the list
59
  ), $comments); ?>
60
  </ul>
61
  </div>
templates/design-manager/design-1/elements/related-posts.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
  $orig_post = $post;
3
  global $post, $redux_builder_amp;
 
 
4
 
5
  if($redux_builder_amp['ampforwp-single-select-type-of-related']==2) {
6
  $categories = get_the_category($post->ID);
@@ -10,7 +12,7 @@
10
  $args=array(
11
  'category__in' => $category_ids,
12
  'post__not_in' => array($post->ID),
13
- 'posts_per_page'=> 3,
14
  'caller_get_posts'=>1
15
  );
16
  }
@@ -24,7 +26,7 @@
24
  $args=array(
25
  'tag__in' => $tag_ids,
26
  'post__not_in' => array($post->ID),
27
- 'posts_per_page'=> 3,
28
  'caller_get_posts'=>1
29
  );
30
  }
1
  <?php
2
  $orig_post = $post;
3
  global $post, $redux_builder_amp;
4
+ $string_number_of_related_posts = $redux_builder_amp['ampforwp-number-of-related-posts'];
5
+ $int_number_of_related_posts = round(abs(floatval($string_number_of_related_posts)));
6
 
7
  if($redux_builder_amp['ampforwp-single-select-type-of-related']==2) {
8
  $categories = get_the_category($post->ID);
12
  $args=array(
13
  'category__in' => $category_ids,
14
  'post__not_in' => array($post->ID),
15
+ 'posts_per_page'=> $int_number_of_related_posts,
16
  'caller_get_posts'=>1
17
  );
18
  }
26
  $args=array(
27
  'tag__in' => $tag_ids,
28
  'post__not_in' => array($post->ID),
29
+ 'posts_per_page'=> $int_number_of_related_posts,
30
  'caller_get_posts'=>1
31
  );
32
  }
templates/design-manager/design-1/elements/social-icons.php CHANGED
@@ -4,7 +4,11 @@
4
  <amp-social-share type="facebook" data-param-app_id="<?php echo $redux_builder_amp['amp-facebook-app-id']; ?>" width="50" height="28"></amp-social-share>
5
  <?php } ?>
6
  <?php if($redux_builder_amp['enable-single-twitter-share'] == true) { ?>
7
- <amp-social-share type="twitter" width="50" height="28"></amp-social-share>
 
 
 
 
8
  <?php } ?>
9
  <?php if($redux_builder_amp['enable-single-gplus-share'] == true) { ?>
10
  <amp-social-share type="gplus" width="50" height="28"></amp-social-share>
4
  <amp-social-share type="facebook" data-param-app_id="<?php echo $redux_builder_amp['amp-facebook-app-id']; ?>" width="50" height="28"></amp-social-share>
5
  <?php } ?>
6
  <?php if($redux_builder_amp['enable-single-twitter-share'] == true) { ?>
7
+ <amp-social-share type="twitter"
8
+ width="50"
9
+ height="28"
10
+ data-param-url="CANONICAL_URL"
11
+ ></amp-social-share>
12
  <?php } ?>
13
  <?php if($redux_builder_amp['enable-single-gplus-share'] == true) { ?>
14
  <amp-social-share type="gplus" width="50" height="28"></amp-social-share>
templates/design-manager/design-1/footer.php CHANGED
@@ -37,6 +37,6 @@ global $redux_builder_amp;
37
  }//End of inner condition
38
  }//End of outer condition?>
39
  </p>
40
-
41
  </div>
42
  </footer>
 
37
  }//End of inner condition
38
  }//End of outer condition?>
39
  </p>
 
40
  </div>
41
  </footer>
42
+ <?php do_action('ampforwp_global_after_footer'); ?>
templates/design-manager/design-1/frontpage.php CHANGED
@@ -1,10 +1,11 @@
1
- <?php global $redux_builder_amp;
2
  $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
3
  $template = new AMP_Post_Template( $post_id );?>
4
  <!doctype html>
5
  <html amp>
6
  <head>
7
  <meta charset="utf-8">
 
8
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
9
  <?php do_action( 'amp_post_template_head', $this ); ?>
10
  <?php
@@ -21,54 +22,64 @@ $template = new AMP_Post_Template( $post_id );?>
21
  </style>
22
  </head>
23
  <body class="single-post amp-wp-frontpage">
24
- <?php $this->load_parts( array( 'header-bar' ) ); ?>
25
 
26
- <?php do_action( 'ampforwp_after_header', $this ); ?>
27
 
28
- <div class="amp-wp-content the_content"> <?php
 
 
 
 
 
 
29
 
30
- do_action( 'ampforwp_before_post_content', $this );
31
 
32
- // Normal Front Page Content
33
- if ( ! $amp_custom_content_enable ) {
34
- echo $template->data['post_amp_content'];
35
- } else {
36
- // Custom/Alternative AMP content added through post meta
37
- echo $template->data['ampforwp_amp_content'];
38
- }
39
 
40
- do_action( 'ampforwp_after_post_content', $this );
41
- ?>
42
-
43
- </div>
44
 
45
- <div class="amp-wp-content post-pagination-meta">
46
- <?php $this->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
47
- </div>
 
 
 
 
 
 
 
 
 
48
 
49
- <?php if($redux_builder_amp['enable-single-social-icons'] == true) { ?>
50
- <div class="sticky_social">
51
- <?php if($redux_builder_amp['enable-single-facebook-share'] == true) { ?>
52
- <amp-social-share type="facebook" width="50" height="28"></amp-social-share>
53
- <?php } ?>
54
- <?php if($redux_builder_amp['enable-single-twitter-share'] == true) { ?>
55
- <amp-social-share type="twitter" width="50" height="28"></amp-social-share>
56
- <?php } ?>
57
- <?php if($redux_builder_amp['enable-single-gplus-share'] == true) { ?>
58
- <amp-social-share type="gplus" width="50" height="28"></amp-social-share>
59
- <?php } ?>
60
- <?php if($redux_builder_amp['enable-single-email-share'] == true) { ?>
61
- <amp-social-share type="email" width="50" height="28"></amp-social-share>
62
- <?php } ?>
63
- <?php if($redux_builder_amp['enable-single-pinterest-share'] == true) { ?>
64
- <amp-social-share type="pinterest" width="50" height="28"></amp-social-share>
65
- <?php } ?>
66
- <?php if($redux_builder_amp['enable-single-linkedin-share'] == true) { ?>
67
- <amp-social-share type="linkedin" width="50" height="28"></amp-social-share>
68
- <?php } ?>
69
  </div>
70
- <?php } ?>
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  <?php $this->load_parts( array( 'footer' ) ); ?>
73
  <?php do_action( 'amp_post_template_footer', $this ); ?>
74
  </body>
1
+ <?php global $redux_builder_amp;
2
  $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
3
  $template = new AMP_Post_Template( $post_id );?>
4
  <!doctype html>
5
  <html amp>
6
  <head>
7
  <meta charset="utf-8">
8
+ <link rel="canonical" href="<?php echo get_permalink( $post_id ) ?>">
9
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
10
  <?php do_action( 'amp_post_template_head', $this ); ?>
11
  <?php
22
  </style>
23
  </head>
24
  <body class="single-post amp-wp-frontpage">
25
+ <?php $this->load_parts( array( 'header-bar' ) ); ?>
26
 
27
+ <article class="amp-wp-article">
28
 
29
+ <header class="amp-wp-article-header ampforwp-title">
30
+ <h1 class="amp-wp-title">
31
+ <?php if( $redux_builder_amp['ampforwp-title-on-front-page'] ) {
32
+ echo get_the_title( $post_id ) ;
33
+ } ?>
34
+ </h1>
35
+ </header>
36
 
37
+ <?php do_action( 'ampforwp_after_header', $this ); ?>
38
 
39
+ <div class="amp-wp-content the_content"> <?php
 
 
 
 
 
 
40
 
41
+ do_action( 'ampforwp_before_post_content', $this );
 
 
 
42
 
43
+ // Normal Front Page Content
44
+ if ( ! $amp_custom_content_enable ) {
45
+ echo $template->data['post_amp_content'];
46
+ } else {
47
+ // Custom/Alternative AMP content added through post meta
48
+ echo $template->data['ampforwp_amp_content'];
49
+ }
50
+
51
+ do_action( 'ampforwp_after_post_content', $this );
52
+ ?>
53
+
54
+ </div>
55
 
56
+ <div class="amp-wp-content post-pagination-meta">
57
+ <?php $this->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  </div>
 
59
 
60
+ <?php if($redux_builder_amp['enable-single-social-icons'] == true) { ?>
61
+ <div class="sticky_social">
62
+ <?php if($redux_builder_amp['enable-single-facebook-share'] == true) { ?>
63
+ <amp-social-share type="facebook" width="50" height="28"></amp-social-share>
64
+ <?php } ?>
65
+ <?php if($redux_builder_amp['enable-single-twitter-share'] == true) { ?>
66
+ <amp-social-share type="twitter" width="50" height="28"></amp-social-share>
67
+ <?php } ?>
68
+ <?php if($redux_builder_amp['enable-single-gplus-share'] == true) { ?>
69
+ <amp-social-share type="gplus" width="50" height="28"></amp-social-share>
70
+ <?php } ?>
71
+ <?php if($redux_builder_amp['enable-single-email-share'] == true) { ?>
72
+ <amp-social-share type="email" width="50" height="28"></amp-social-share>
73
+ <?php } ?>
74
+ <?php if($redux_builder_amp['enable-single-pinterest-share'] == true) { ?>
75
+ <amp-social-share type="pinterest" width="50" height="28"></amp-social-share>
76
+ <?php } ?>
77
+ <?php if($redux_builder_amp['enable-single-linkedin-share'] == true) { ?>
78
+ <amp-social-share type="linkedin" width="50" height="28"></amp-social-share>
79
+ <?php } ?>
80
+ </div>
81
+ <?php } ?>
82
+ </article>
83
  <?php $this->load_parts( array( 'footer' ) ); ?>
84
  <?php do_action( 'amp_post_template_footer', $this ); ?>
85
  </body>
templates/design-manager/design-1/index.php CHANGED
@@ -4,6 +4,14 @@
4
  <head>
5
  <meta charset="utf-8">
6
  <link rel="dns-prefetch" href="https://cdn.ampproject.org">
 
 
 
 
 
 
 
 
7
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
8
  <?php do_action( 'amp_post_template_head', $this ); ?>
9
  <style amp-custom>
4
  <head>
5
  <meta charset="utf-8">
6
  <link rel="dns-prefetch" href="https://cdn.ampproject.org">
7
+ <?php
8
+ global $redux_builder_amp;
9
+ if ( is_home() || is_front_page() ){
10
+ global $wp;
11
+ $current_archive_url = home_url( $wp->request );
12
+ $amp_url = trailingslashit($current_archive_url);
13
+ } ?>
14
+ <link rel="canonical" href="<?php echo $amp_url ?>">
15
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
16
  <?php do_action( 'amp_post_template_head', $this ); ?>
17
  <style amp-custom>
templates/design-manager/design-1/single.php CHANGED
@@ -11,7 +11,7 @@
11
  </style>
12
  </head>
13
 
14
- <body class="<?php echo esc_attr( $this->get( 'body_class' ) ); ?>">
15
 
16
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
17
 
@@ -19,7 +19,27 @@
19
  <?php do_action('ampforwp_post_before_design_elements') ?>
20
 
21
  <?php $this->load_parts( apply_filters( 'ampforwp_design_elements', array( 'empty-filter' ) ) ); ?>
22
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  <?php do_action('ampforwp_post_after_design_elements') ?>
24
  </article>
25
 
@@ -29,3 +49,10 @@
29
 
30
  </body>
31
  </html>
 
 
 
 
 
 
 
11
  </style>
12
  </head>
13
 
14
+ <body class="<?php echo esc_attr( $this->get( 'body_class' ) ); ?> single-post <?php if(is_page()){ echo'amp-single-page'; };?>">
15
 
16
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
17
 
19
  <?php do_action('ampforwp_post_before_design_elements') ?>
20
 
21
  <?php $this->load_parts( apply_filters( 'ampforwp_design_elements', array( 'empty-filter' ) ) ); ?>
22
+ <?php
23
+ global $redux_builder_amp;
24
+
25
+ $data = get_option( 'ampforwp_design' );
26
+ if( isset( $data['elements'] ) || ! empty( $data['elements'] ) ){
27
+ $options = explode( ',', $data['elements'] );
28
+ }
29
+ $count = 0;
30
+ if( $options ) {
31
+ $values = array_values($options );
32
+ global $post;
33
+ $comments_count = wp_count_comments($post->ID);
34
+ if( in_array('comments:0',$values) ) {
35
+ button_code();
36
+ $count++;
37
+ }
38
+ }
39
+ if($count === 0 && $comments_count->approved == 0) {
40
+ button_code();
41
+ }
42
+ ?>
43
  <?php do_action('ampforwp_post_after_design_elements') ?>
44
  </article>
45
 
49
 
50
  </body>
51
  </html>
52
+
53
+ <?php
54
+ function button_code() { global $redux_builder_amp ;?>
55
+ <div class="comment-button-wrapper">
56
+ <a href="<?php echo get_permalink().'#commentform' ?>"><?php esc_html_e( $redux_builder_amp['amp-translator-leave-a-comment-text'] ); ?></a>
57
+ </div>
58
+ <?php }
templates/design-manager/design-1/style.php CHANGED
@@ -229,7 +229,10 @@ blockquote p:last-child {
229
  }
230
  /* Front page */
231
  .amp-wp-frontpage .the_content {
232
- padding: 10px;
 
 
 
233
  }
234
  /* Article Content */
235
  .amp-wp-article a{
@@ -572,7 +575,9 @@ amp-carousel > amp-img > img {
572
  padding:0
573
  }
574
  .comments_list ul.children{
575
- padding-bottom:10px;
 
 
576
  }
577
  .comments_list ul li p{
578
  margin: 0;
@@ -594,6 +599,7 @@ amp-carousel > amp-img > img {
594
  box-shadow: 0 2px 3px rgba(0,0,0,.05);
595
  padding: 0px;
596
  max-width: 1000px;
 
597
  }
598
  .comments_list ul li .says{
599
  margin-right: 4px;
229
  }
230
  /* Front page */
231
  .amp-wp-frontpage .the_content {
232
+ padding: 10px;
233
+ }
234
+ .amp-wp-frontpage .ampforwp-title {
235
+ margin-left:10px;
236
  }
237
  /* Article Content */
238
  .amp-wp-article a{
575
  padding:0
576
  }
577
  .comments_list ul.children{
578
+ padding-bottom:10px;
579
+ margin-left: 4%;
580
+ width: 96%;
581
  }
582
  .comments_list ul li p{
583
  margin: 0;
599
  box-shadow: 0 2px 3px rgba(0,0,0,.05);
600
  padding: 0px;
601
  max-width: 1000px;
602
+ width:96%;
603
  }
604
  .comments_list ul li .says{
605
  margin-right: 4px;
templates/design-manager/design-2/elements/comments.php CHANGED
@@ -9,27 +9,23 @@
9
  ));
10
  if ( $comments ) { ?>
11
  <div class="amp-wp-content comments_list">
12
- <h3><?php echo $redux_builder_amp['amp-translator-view-comments-text'] ?></h3>
13
- <ul>
14
  <?php
15
  // Display the list of comments
16
  function ampforwp_custom_translated_comment($comment, $args, $depth){
17
- $GLOBALS['comment'] = $comment; ?>
18
- <?php if('0' === $comment->comment_parent){ ?>
 
19
  <li id="li-comment-<?php comment_ID() ?>"
20
  <?php comment_class(); ?> >
21
  <article id="comment-<?php comment_ID(); ?>" class="comment-body">
22
  <footer class="comment-meta">
23
  <div class="comment-author vcard">
24
- <?php global $redux_builder_amp;
25
  printf(__('<b class="fn">%s</b> <span class="says">'.$redux_builder_amp['amp-translator-says-text'].':</span>'), get_comment_author_link()) ?>
26
  </div>
27
  <!-- .comment-author -->
28
- <?php if ($comment->comment_approved == '0') : ?>
29
- <em><?php _e('Your comment is awaiting moderation.') ?></em>
30
- <br />
31
- <?php endif; ?>
32
- <!--comment moderation ends here-->
33
  <div class="comment-metadata">
34
  <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
35
  <?php
@@ -50,101 +46,22 @@
50
  </li>
51
  <!-- #comment-## -->
52
  <?php
53
- }else {?>
54
- <li id="li-comment-<?php comment_ID() ?>"
55
- <?php comment_class(); ?> >
56
- <article id="comment-<?php comment_ID(); ?>" class="comment-body">
57
- <footer class="comment-meta">
58
- <div class="comment-author vcard">
59
- <?php global $redux_builder_amp;
60
- printf(__('<b class="fn">%s</b> <span class="says">'.$redux_builder_amp['amp-translator-says-text'].':</span>'), get_comment_author_link()) ?>
61
- </div>
62
- <!-- .comment-author -->
63
- <?php if ($comment->comment_approved == '0') : ?>
64
- <em><?php _e('Your comment is awaiting moderation.') ?></em>
65
- <br />
66
- <?php endif; ?>
67
- <!--comment moderation ends here-->
68
- <div class="comment-metadata">
69
- <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
70
- <?php
71
- printf(__('%1$s '.$redux_builder_amp['amp-translator-at-text'].' %2$s'), get_comment_date(), get_comment_time())
72
- ?>
73
- </a>
74
- <?php edit_comment_link(__('('.$redux_builder_amp['amp-translator-Edit-text'].')'),' ','') ?>
75
- </div>
76
- <!-- .comment-metadata -->
77
- </footer>
78
- <!-- .comment-meta -->
79
- <div class="comment-content">
80
- <p><?php echo get_comment_text(); ?></p>
81
- </div>
82
- <!-- .comment-content -->
83
- <?php ampforwp_custom_translated_comment_nested($comment, $args, $depth);
84
- ?>
85
- </article>
86
- <!-- .comment-body -->
87
- </li>
88
- <!-- #comment-## -->
89
- <?php
90
- }
91
  }// end of ampforwp_custom_translated_comment()
92
 
93
- function ampforwp_custom_translated_comment_nested($comment, $args, $depth){
94
- $GLOBALS['comment'] = $comment; ?>
95
- <ul class="children">
96
- <li id="li-comment-<?php comment_ID() ?>"
97
- <?php comment_class(); ?> >
98
- <article id="comment-<?php comment_ID(); ?>" class="comment-body">
99
- <footer class="comment-meta">
100
- <div class="comment-author vcard">
101
- <?php global $redux_builder_amp;
102
- printf(__('<b class="fn">%s</b> <span class="says">'.$redux_builder_amp['amp-translator-says-text'].':</span>'), get_comment_author_link()) ?>
103
- </div>
104
- <!-- .comment-author -->
105
- <?php if ($comment->comment_approved == '0') : ?>
106
- <em><?php _e('Your comment is awaiting moderation.') ?></em>
107
- <br />
108
- <?php endif; ?>
109
- <!--comment moderation ends here-->
110
- <div class="comment-metadata">
111
- <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
112
- <?php
113
- printf(__('%1$s '.$redux_builder_amp['amp-translator-at-text'].' %2$s'), get_comment_date(), get_comment_time())
114
- ?>
115
- </a>
116
- <?php edit_comment_link(__('('.$redux_builder_amp['amp-translator-Edit-text'].')'),' ','') ?>
117
- </div>
118
- <!-- .comment-metadata -->
119
- </footer>
120
- <!-- .comment-meta -->
121
- <div class="comment-content">
122
- <p><?php echo get_comment_text(); ?></p>
123
- </div>
124
- <!-- .comment-content -->
125
- </article>
126
- <!-- .comment-body -->
127
- </li>
128
- <!-- #comment-## -->
129
- </ul>
130
- <!-- .children -->
131
- <?php
132
- }// end of ampforwp_custom_translated_comment_nested()
133
-
134
  wp_list_comments( array(
135
  'per_page' => 10, //Allow comment pagination
136
  'style' => 'li',
137
  'type' => 'comment',
138
- 'max_depth' => 0,
139
  'avatar_size' => 0,
140
  'callback' => 'ampforwp_custom_translated_comment',
141
- 'reverse_top_level' => false //Show the latest comments at the top of the list
142
  ), $comments); ?>
143
  </ul>
144
  </div>
145
- <div class="comment-button-wrapper">
146
  <a href="<?php echo get_permalink().'#commentform' ?>"><?php esc_html_e( $redux_builder_amp['amp-translator-leave-a-comment-text'] ); ?></a>
147
  </div><?php
148
  }
149
  ?>
150
- </div>
9
  ));
10
  if ( $comments ) { ?>
11
  <div class="amp-wp-content comments_list">
12
+ <h3><?php global $redux_builder_amp; echo $redux_builder_amp['amp-translator-view-comments-text'] ?></h3>
13
+ <ul>
14
  <?php
15
  // Display the list of comments
16
  function ampforwp_custom_translated_comment($comment, $args, $depth){
17
+ $GLOBALS['comment'] = $comment;
18
+ global $redux_builder_amp;
19
+ ?>
20
  <li id="li-comment-<?php comment_ID() ?>"
21
  <?php comment_class(); ?> >
22
  <article id="comment-<?php comment_ID(); ?>" class="comment-body">
23
  <footer class="comment-meta">
24
  <div class="comment-author vcard">
25
+ <?php
26
  printf(__('<b class="fn">%s</b> <span class="says">'.$redux_builder_amp['amp-translator-says-text'].':</span>'), get_comment_author_link()) ?>
27
  </div>
28
  <!-- .comment-author -->
 
 
 
 
 
29
  <div class="comment-metadata">
30
  <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
31
  <?php
46
  </li>
47
  <!-- #comment-## -->
48
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }// end of ampforwp_custom_translated_comment()
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  wp_list_comments( array(
52
  'per_page' => 10, //Allow comment pagination
53
  'style' => 'li',
54
  'type' => 'comment',
55
+ 'max_depth' => 5,
56
  'avatar_size' => 0,
57
  'callback' => 'ampforwp_custom_translated_comment',
58
+ 'reverse_top_level' => true //Show the latest comments at the top of the list
59
  ), $comments); ?>
60
  </ul>
61
  </div>
62
+ <div class="comment-button-wrapper">
63
  <a href="<?php echo get_permalink().'#commentform' ?>"><?php esc_html_e( $redux_builder_amp['amp-translator-leave-a-comment-text'] ); ?></a>
64
  </div><?php
65
  }
66
  ?>
67
+ </div>
templates/design-manager/design-2/elements/related-posts.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
  $orig_post = $post;
3
  global $post, $redux_builder_amp;
 
4
 
5
  if($redux_builder_amp['ampforwp-single-select-type-of-related']==2){
6
  $categories = get_the_category($post->ID);
@@ -10,7 +11,7 @@
10
  $args=array(
11
  'category__in' => $category_ids,
12
  'post__not_in' => array($post->ID),
13
- 'posts_per_page'=> 3,
14
  'caller_get_posts'=>1
15
  );
16
  }
@@ -24,7 +25,7 @@
24
  $args=array(
25
  'tag__in' => $tag_ids,
26
  'post__not_in' => array($post->ID),
27
- 'posts_per_page'=> 3,
28
  'caller_get_posts'=>1,
29
  );
30
  }
@@ -53,7 +54,7 @@
53
  <?php if ( has_post_thumbnail() ) { ?>
54
  <amp-img src="<?php echo esc_url( $thumb_url_2 ); ?>" width="150" height="150" layout="responsive"></amp-img>
55
  <?php } ?>
56
- </a>
57
  <div class="related_link">
58
  <a href="<?php echo esc_url( $related_post_permalink ); ?>"><?php the_title(); ?></a>
59
  <?php if(has_excerpt()){
1
  <?php
2
  $orig_post = $post;
3
  global $post, $redux_builder_amp;
4
+ $string_number_of_related_posts = $redux_builder_amp['ampforwp-number-of-related-posts']; $int_number_of_related_posts = round(abs(floatval($string_number_of_related_posts)));
5
 
6
  if($redux_builder_amp['ampforwp-single-select-type-of-related']==2){
7
  $categories = get_the_category($post->ID);
11
  $args=array(
12
  'category__in' => $category_ids,
13
  'post__not_in' => array($post->ID),
14
+ 'posts_per_page'=> $int_number_of_related_posts,
15
  'caller_get_posts'=>1
16
  );
17
  }
25
  $args=array(
26
  'tag__in' => $tag_ids,
27
  'post__not_in' => array($post->ID),
28
+ 'posts_per_page'=> $int_number_of_related_posts,
29
  'caller_get_posts'=>1,
30
  );
31
  }
54
  <?php if ( has_post_thumbnail() ) { ?>
55
  <amp-img src="<?php echo esc_url( $thumb_url_2 ); ?>" width="150" height="150" layout="responsive"></amp-img>
56
  <?php } ?>
57
+ </a>
58
  <div class="related_link">
59
  <a href="<?php echo esc_url( $related_post_permalink ); ?>"><?php the_title(); ?></a>
60
  <?php if(has_excerpt()){
templates/design-manager/design-2/elements/social-icons.php CHANGED
@@ -4,7 +4,11 @@
4
  <amp-social-share type="facebook" data-param-app_id="<?php echo $redux_builder_amp['amp-facebook-app-id']; ?>" width="50" height="28"></amp-social-share>
5
  <?php } ?>
6
  <?php if($redux_builder_amp['enable-single-twitter-share'] == true) { ?>
7
- <amp-social-share type="twitter" width="50" height="28"></amp-social-share>
 
 
 
 
8
  <?php } ?>
9
  <?php if($redux_builder_amp['enable-single-gplus-share'] == true) { ?>
10
  <amp-social-share type="gplus" width="50" height="28"></amp-social-share>
4
  <amp-social-share type="facebook" data-param-app_id="<?php echo $redux_builder_amp['amp-facebook-app-id']; ?>" width="50" height="28"></amp-social-share>
5
  <?php } ?>
6
  <?php if($redux_builder_amp['enable-single-twitter-share'] == true) { ?>
7
+ <amp-social-share type="twitter"
8
+ width="50"
9
+ height="28"
10
+ data-param-url="CANONICAL_URL"
11
+ ></amp-social-share>
12
  <?php } ?>
13
  <?php if($redux_builder_amp['enable-single-gplus-share'] == true) { ?>
14
  <amp-social-share type="gplus" width="50" height="28"></amp-social-share>
templates/design-manager/design-2/frontpage.php CHANGED
@@ -5,6 +5,9 @@ $template = new AMP_Post_Template( $post_id );?>
5
  <html amp>
6
  <head>
7
  <meta charset="utf-8">
 
 
 
8
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
9
  <?php do_action( 'amp_post_template_head', $this ); ?>
10
  <?php
@@ -23,6 +26,17 @@ $template = new AMP_Post_Template( $post_id );?>
23
  <body class="single-post">
24
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
25
 
 
 
 
 
 
 
 
 
 
 
 
26
  <?php do_action( 'ampforwp_after_header', $this ); ?>
27
 
28
  <main>
@@ -34,7 +48,7 @@ $template = new AMP_Post_Template( $post_id );?>
34
  } else {
35
  // Custom/Alternative AMP content added through post meta
36
  echo $template->data['ampforwp_amp_content'];
37
- }
38
 
39
  do_action( 'ampforwp_after_post_content', $this ); ?>
40
 
5
  <html amp>
6
  <head>
7
  <meta charset="utf-8">
8
+ <link rel="canonical" href="<?php
9
+ $ID = $redux_builder_amp['amp-frontpage-select-option-pages'];
10
+ echo get_permalink( $ID ) ?>">
11
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
12
  <?php do_action( 'amp_post_template_head', $this ); ?>
13
  <?php
26
  <body class="single-post">
27
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
28
 
29
+ <header class="amp-wp-article-header ampforwp-title">
30
+ <h1 class="amp-wp-title">
31
+ <?php global $redux_builder_amp;
32
+ $ID = $redux_builder_amp['amp-frontpage-select-option-pages'];
33
+ if( $redux_builder_amp['ampforwp-title-on-front-page'] ) {
34
+ echo get_the_title( $ID ) ;
35
+ }
36
+ ?>
37
+ </h1>
38
+ </header>
39
+
40
  <?php do_action( 'ampforwp_after_header', $this ); ?>
41
 
42
  <main>
48
  } else {
49
  // Custom/Alternative AMP content added through post meta
50
  echo $template->data['ampforwp_amp_content'];
51
+ }
52
 
53
  do_action( 'ampforwp_after_post_content', $this ); ?>
54
 
templates/design-manager/design-2/index.php CHANGED
@@ -3,7 +3,15 @@
3
  <html amp>
4
  <head>
5
  <meta charset="utf-8">
6
- <link rel="dns-prefetch" href="https://cdn.ampproject.org">
 
 
 
 
 
 
 
 
7
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
8
  <?php do_action( 'amp_post_template_head', $this ); ?>
9
 
@@ -20,7 +28,7 @@
20
  <main>
21
 
22
 
23
- <?php if ( is_archive() ) {
24
  the_archive_title( '<h3 class="page-title">', '</h3>' );
25
  the_archive_description( '<div class="taxonomy-description">', '</div>' );
26
  } ?>
3
  <html amp>
4
  <head>
5
  <meta charset="utf-8">
6
+ <link rel="dns-prefetch" href="https://cdn.ampproject.org">
7
+ <?php
8
+ global $redux_builder_amp;
9
+ if ( is_home() || is_front_page() ){
10
+ global $wp;
11
+ $current_archive_url = home_url( $wp->request );
12
+ $amp_url = trailingslashit($current_archive_url);
13
+ } ?>
14
+ <link rel="canonical" href="<?php echo $amp_url ?>">
15
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
16
  <?php do_action( 'amp_post_template_head', $this ); ?>
17
 
28
  <main>
29
 
30
 
31
+ <?php if ( is_archive() ) {
32
  the_archive_title( '<h3 class="page-title">', '</h3>' );
33
  the_archive_description( '<div class="taxonomy-description">', '</div>' );
34
  } ?>
templates/design-manager/design-2/single.php CHANGED
@@ -11,7 +11,7 @@
11
  <?php do_action( 'amp_post_template_css', $this ); ?>
12
  </style>
13
  </head>
14
- <body class="single-post">
15
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
16
 
17
  <?php do_action( 'ampforwp_after_header', $this ); ?>
@@ -20,7 +20,26 @@
20
  <?php do_action('ampforwp_post_before_design_elements') ?>
21
 
22
  <?php $this->load_parts( apply_filters( 'ampforwp_design_elements', array( 'empty-filter' ) ) ); ?>
 
 
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  <?php do_action('ampforwp_post_after_design_elements') ?>
25
  </article>
26
  </main>
@@ -28,3 +47,10 @@
28
  <?php do_action( 'amp_post_template_footer', $this ); ?>
29
  </body>
30
  </html>
 
 
 
 
 
 
 
11
  <?php do_action( 'amp_post_template_css', $this ); ?>
12
  </style>
13
  </head>
14
+ <body class="single-post <?php if(is_page()){ echo'amp-single-page'; };?>">
15
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
16
 
17
  <?php do_action( 'ampforwp_after_header', $this ); ?>
20
  <?php do_action('ampforwp_post_before_design_elements') ?>
21
 
22
  <?php $this->load_parts( apply_filters( 'ampforwp_design_elements', array( 'empty-filter' ) ) ); ?>
23
+ <?php
24
+ global $redux_builder_amp;
25
 
26
+ $data = get_option( 'ampforwp_design' );
27
+ if( isset( $data['elements'] ) || ! empty( $data['elements'] ) ){
28
+ $options = explode( ',', $data['elements'] );
29
+ }$count = 0;
30
+ if( $options ) {
31
+ $values = array_values($options );
32
+ global $post;
33
+ $comments_count = wp_count_comments($post->ID);
34
+ if( in_array('comments:0',$values) ) {
35
+ button_code();
36
+ $count++;
37
+ }
38
+ }
39
+ if($count === 0 && $comments_count->approved == 0) {
40
+ button_code();
41
+ }
42
+ ?>
43
  <?php do_action('ampforwp_post_after_design_elements') ?>
44
  </article>
45
  </main>
47
  <?php do_action( 'amp_post_template_footer', $this ); ?>
48
  </body>
49
  </html>
50
+
51
+ <?php
52
+ function button_code() { global $redux_builder_amp ;?>
53
+ <div class="comment-button-wrapper">
54
+ <a href="<?php echo get_permalink().'#commentform' ?>"><?php esc_html_e( $redux_builder_amp['amp-translator-leave-a-comment-text'] ); ?></a>
55
+ </div>
56
+ <?php }
templates/design-manager/design-2/style.php CHANGED
@@ -405,7 +405,7 @@ main .amp-wp-content.featured-image-content {
405
  box-shadow: none
406
  }
407
  .amp-wp-content.post-pagination-meta{
408
- max-width: 1030px;
409
  }
410
  .single-post .ampforwp-social-icons.ampforwp-social-icons-wrapper {
411
  display: block;
@@ -496,7 +496,9 @@ main .amp-wp-content.comments_list {
496
  padding:0
497
  }
498
  .comments_list ul.children{
499
- padding-bottom:10px;
 
 
500
  }
501
  .comments_list ul li p{
502
  margin:0;
@@ -517,6 +519,7 @@ main .amp-wp-content.comments_list {
517
  box-shadow: 0 2px 3px rgba(0,0,0,.05);
518
  padding: 0px;
519
  max-width: 1000px;
 
520
  }
521
  .comments_list ul li .comment-body{
522
  padding: 25px;
@@ -813,8 +816,6 @@ amp-user-notification button {
813
  }
814
 
815
 
816
-
817
-
818
  /* Custom Style Code */
819
  <?php echo $redux_builder_amp['css_editor'];
820
  } ?>
405
  box-shadow: none
406
  }
407
  .amp-wp-content.post-pagination-meta{
408
+ max-width: 1030px;
409
  }
410
  .single-post .ampforwp-social-icons.ampforwp-social-icons-wrapper {
411
  display: block;
496
  padding:0
497
  }
498
  .comments_list ul.children{
499
+ padding-bottom:10px;
500
+ margin-left: 4%;
501
+ width: 96%;
502
  }
503
  .comments_list ul li p{
504
  margin:0;
519
  box-shadow: 0 2px 3px rgba(0,0,0,.05);
520
  padding: 0px;
521
  max-width: 1000px;
522
+ width:96%;
523
  }
524
  .comments_list ul li .comment-body{
525
  padding: 25px;
816
  }
817
 
818
 
 
 
819
  /* Custom Style Code */
820
  <?php echo $redux_builder_amp['css_editor'];
821
  } ?>
templates/features.php CHANGED
@@ -74,16 +74,25 @@
74
  return;
75
  }
76
  if ( is_home() || is_front_page() ){
77
- $amp_url = home_url('/?amp');
 
 
78
  }
79
  else {
80
  $amp_url = amp_get_permalink( get_queried_object_id() );
81
- }
82
- printf( '<link rel="amphtml" href="%s" />', esc_url( $amp_url ) );
 
 
 
 
 
 
 
83
  } //end of ampforwp_home_archive_rel_canonical()
84
 
85
 
86
- // Remove default wordpress rel canonical
87
  add_filter('amp_frontend_show_canonical','ampforwp_remove_default_canonical');
88
  if (! function_exists('ampforwp_remove_default_canonical') ) {
89
  function ampforwp_remove_default_canonical() {
@@ -176,22 +185,35 @@
176
  // 6. Add required Javascripts for extra AMP features
177
  add_action('amp_post_template_head','ampforwp_register_additional_scripts', 20);
178
  function ampforwp_register_additional_scripts() {
179
- global $redux_builder_amp;
180
- ?><script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
181
- <?php if( is_page() ) { ?><script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script><?php } ?>
182
- <script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"></script>
183
- <?php if($redux_builder_amp['amp-enable-notifications'] == true) { ?>
184
- <script async custom-element="amp-user-notification" src="https://cdn.ampproject.org/v0/amp-user-notification-0.1.js"></script>
185
- <?php } ?>
186
- <?php if( $redux_builder_amp['enable-single-social-icons'] == true || AMPFORWP_DM_SOCIAL_CHECK === 'true' ) { ?>
187
- <?php if( is_singular() ) { ?><script async custom-element="amp-social-share" src="https://cdn.ampproject.org/v0/amp-social-share-0.1.js"></script>
188
- <?php } } ?>
189
- <?php if($redux_builder_amp['amp-frontpage-select-option'] == 1) { ?>
190
- <?php if( is_front_page() ) { ?>
191
- <script async custom-element="amp-social-share" src="https://cdn.ampproject.org/v0/amp-social-share-0.1.js"></script>
192
- <?php } } ?>
193
- <script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>
194
- <?php }
 
 
 
 
 
 
 
 
 
 
 
 
 
195
 
196
  // 7. Footer for AMP Pages
197
  add_filter( 'amp_post_template_file', 'ampforwp_custom_footer', 10, 3 );
@@ -456,20 +478,31 @@ global $redux_builder_amp;
456
  $content = preg_replace('#<plusone.*?>(.*?)</plusone>#i', '', $content);
457
  $content = preg_replace('#<col.*?>#i', '', $content);
458
  $content = preg_replace('#<table.*?>#i', '<table width="100%">', $content);
459
- $content = preg_replace('#<style scoped.*?>(.*?)</style>#i', '', $content);
 
460
  $content = preg_replace('/href="javascript:void*/', ' ', $content);
461
  $content = preg_replace('/<script[^>]*>.*?<\/script>/i', '', $content);
462
  //for removing attributes within html tags
463
  $content = preg_replace('/(<[^>]+) onclick=".*?"/', '$1', $content);
 
464
  $content = preg_replace('/(<[^>]+) style=".*?"/', '$1', $content);
 
465
  $content = preg_replace('/(<[^>]+) rel=".*?"/', '$1', $content);
466
  $content = preg_replace('/(<[^>]+) ref=".*?"/', '$1', $content);
467
  $content = preg_replace('/(<[^>]+) date/', '$1', $content);
 
468
 
469
  //removing scripts and rel="nofollow" from Body and from divs
470
  //issue #268
471
  $content = str_replace(' rel="nofollow"',"",$content);
472
  $content = preg_replace('/<script[^>]*>.*?<\/script>/i', '', $content);
 
 
 
 
 
 
 
473
 
474
  // $content = preg_replace('/<img*/', '<amp-img', $content); // Fallback for plugins
475
  return $content;
@@ -482,8 +515,8 @@ global $redux_builder_amp;
482
  add_filter( 'wp_footer', 'ampforwp_the_content_filter_footer', 1 );
483
  }
484
  function ampforwp_the_content_filter_footer( $content ) {
485
- remove_all_actions('wp_footer');
486
- return $content;
487
  }
488
 
489
  // 11.5 Strip unwanted codes the_content of Frontpage
@@ -697,35 +730,32 @@ function ampforwp_remove_print_scripts() {
697
  add_action( 'template_redirect', 'ampforwp_remove_print_scripts' );
698
 
699
  // 17. Archives Canonical in AMP version
700
- function ampforwp_rel_canonical_archive() {
701
- if ( !is_archive() )
702
- return;
703
- global $wp;
704
- $current_archive_url = home_url( $wp->request );
705
- // $archivelink = esc_url( get_permalink( $id ) . AMP_QUERY_VAR . '/' );
706
- echo "<link rel='canonical' href='$current_archive_url' />\n";
707
- }
708
- add_action( 'amp_post_template_head', 'ampforwp_rel_canonical_archive' );
709
 
710
  // 18. Custom Canonical for Homepage
711
- function ampforwp_rel_canonical() {
712
- if ( !is_home() )
713
- return;
714
- // $link = esc_url( get_permalink( $id ) . AMP_QUERY_VAR . '/' );
715
- $homelink = get_home_url();
716
- echo "<link rel='canonical' href='$homelink' />\n";
717
- }
718
- add_action( 'amp_post_template_head', 'ampforwp_rel_canonical' );
719
 
720
  // 18.5. Custom Canonical for Frontpage
721
- //function ampforwp_rel_canonical_frontpage() {
722
  // if ( is_home() || is_front_page() )
723
  // return;
724
- //// $link = esc_url( get_permalink( $id ) . AMP_QUERY_VAR . '/' );
725
  // $homelink = get_home_url();
726
  // echo "<link rel='canonical' href='$homelink' />\n";
727
- //}
728
- //add_action( 'amp_post_template_head', 'ampforwp_rel_canonical_frontpage' );
729
 
730
  // 19. Remove Canonical tags
731
  function ampforwp_amp_remove_actions() {
@@ -773,7 +803,11 @@ function ampforwp_sticky_social_icons(){
773
  <amp-social-share type="facebook" data-param-app_id="<?php echo $redux_builder_amp['amp-facebook-app-id']; ?>" width="50" height="28"></amp-social-share>
774
  <?php } ?>
775
  <?php if($redux_builder_amp['enable-single-twitter-share'] == true) { ?>
776
- <amp-social-share type="twitter" width="50" height="28"></amp-social-share>
 
 
 
 
777
  <?php } ?>
778
  <?php if($redux_builder_amp['enable-single-gplus-share'] == true) { ?>
779
  <amp-social-share type="gplus" width="50" height="28"></amp-social-share>
@@ -853,24 +887,29 @@ function remove_this(){
853
  $title = $post->post_title;
854
  echo $title . ' | ' . get_option( 'blogname' ) ;
855
  }
856
- // title for archive pages
857
- if ( is_archive() ) {
858
- the_archive_title( '' );
859
- the_archive_description( '' );
860
- }
861
- // title for Static front page
862
- if ( $redux_builder_amp['amp-frontpage-select-option']== 1 && ( is_front_page() ) ) {
863
- $ID = $redux_builder_amp['amp-frontpage-select-option-pages'];
864
- echo get_the_title( $ID ) . ' | ' . get_option('blogname');
865
 
 
 
 
 
 
866
  }
867
- // title for index page
868
- if ( is_front_page() && $redux_builder_amp['amp-frontpage-select-option']== 0 ) {
869
- echo bloginfo('name') . ' | ' . get_option( 'blogdescription' ) ;
870
- }
871
- ?>
872
  </title>
873
  <?php
874
  }
875
  }
876
  //End of 26
 
 
 
 
 
 
 
 
 
 
 
 
74
  return;
75
  }
76
  if ( is_home() || is_front_page() ){
77
+ global $wp;
78
+ $current_archive_url = home_url( $wp->request );
79
+ $amp_url = trailingslashit($current_archive_url).'?amp';
80
  }
81
  else {
82
  $amp_url = amp_get_permalink( get_queried_object_id() );
83
+ }
84
+
85
+ global $post;
86
+ $ampforwp_amp_post_on_off_meta = get_post_meta( $post->ID );
87
+ if( $ampforwp_amp_post_on_off_meta['ampforwp-amp-on-off'][0] === 'hide-amp' ) {
88
+ //dont Echo anything
89
+ } else {
90
+ printf( '<link rel="amphtml" href="%s" />', esc_url( $amp_url ) );
91
+ }
92
  } //end of ampforwp_home_archive_rel_canonical()
93
 
94
 
95
+ // Remove default wordpress rel canonical
96
  add_filter('amp_frontend_show_canonical','ampforwp_remove_default_canonical');
97
  if (! function_exists('ampforwp_remove_default_canonical') ) {
98
  function ampforwp_remove_default_canonical() {
185
  // 6. Add required Javascripts for extra AMP features
186
  add_action('amp_post_template_head','ampforwp_register_additional_scripts', 20);
187
  function ampforwp_register_additional_scripts() {
188
+ global $redux_builder_amp;
189
+
190
+ if ( class_exists('WPSEO_Options') && class_exists('YoastSEO_AMP') ) {
191
+ $yoast_glue_seo = get_option('wpseo_amp');
192
+ }
193
+ if ( empty( $yoast_glue_seo['analytics-extra'] ) ) { ?>
194
+ <script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
195
+ <?php
196
+ }
197
+
198
+ if( is_page() ) { ?>
199
+ <script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
200
+ <?php } ?>
201
+ <script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"></script>
202
+ <?php if($redux_builder_amp['amp-enable-notifications'] == true) { ?>
203
+ <script async custom-element="amp-user-notification" src="https://cdn.ampproject.org/v0/amp-user-notification-0.1.js"></script>
204
+ <?php } ?>
205
+ <?php if( $redux_builder_amp['enable-single-social-icons'] == true || AMPFORWP_DM_SOCIAL_CHECK === 'true' ) { ?>
206
+ <?php if( is_singular() ) { ?>
207
+ <script async custom-element="amp-social-share" src="https://cdn.ampproject.org/v0/amp-social-share-0.1.js"></script>
208
+ <?php }
209
+ } ?>
210
+ <?php if($redux_builder_amp['amp-frontpage-select-option'] == 1) { ?>
211
+ <?php if( is_home() ) { ?>
212
+ <script async custom-element="amp-social-share" src="https://cdn.ampproject.org/v0/amp-social-share-0.1.js"></script>
213
+ <?php }
214
+ } ?>
215
+ <script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script><?php
216
+ }
217
 
218
  // 7. Footer for AMP Pages
219
  add_filter( 'amp_post_template_file', 'ampforwp_custom_footer', 10, 3 );
478
  $content = preg_replace('#<plusone.*?>(.*?)</plusone>#i', '', $content);
479
  $content = preg_replace('#<col.*?>#i', '', $content);
480
  $content = preg_replace('#<table.*?>#i', '<table width="100%">', $content);
481
+ /* Removed So Inline style can work
482
+ $content = preg_replace('#<style scoped.*?>(.*?)</style>#i', '', $content); */
483
  $content = preg_replace('/href="javascript:void*/', ' ', $content);
484
  $content = preg_replace('/<script[^>]*>.*?<\/script>/i', '', $content);
485
  //for removing attributes within html tags
486
  $content = preg_replace('/(<[^>]+) onclick=".*?"/', '$1', $content);
487
+ /* Removed So Inline style can work
488
  $content = preg_replace('/(<[^>]+) style=".*?"/', '$1', $content);
489
+ */
490
  $content = preg_replace('/(<[^>]+) rel=".*?"/', '$1', $content);
491
  $content = preg_replace('/(<[^>]+) ref=".*?"/', '$1', $content);
492
  $content = preg_replace('/(<[^>]+) date/', '$1', $content);
493
+ $content = preg_replace('/(<[^>]+) spellcheck/', '$1', $content);
494
 
495
  //removing scripts and rel="nofollow" from Body and from divs
496
  //issue #268
497
  $content = str_replace(' rel="nofollow"',"",$content);
498
  $content = preg_replace('/<script[^>]*>.*?<\/script>/i', '', $content);
499
+ /// simpy add more elements to simply strip tag but not the content as so
500
+ /// Array ("p","font");
501
+ $tags_to_strip = Array("thrive_headline" );
502
+ foreach ($tags_to_strip as $tag)
503
+ {
504
+ $content = preg_replace("/<\\/?" . $tag . "(.|\\s)*?>/",'',$content);
505
+ }
506
 
507
  // $content = preg_replace('/<img*/', '<amp-img', $content); // Fallback for plugins
508
  return $content;
515
  add_filter( 'wp_footer', 'ampforwp_the_content_filter_footer', 1 );
516
  }
517
  function ampforwp_the_content_filter_footer( $content ) {
518
+ remove_all_actions('wp_footer');
519
+ return $content;
520
  }
521
 
522
  // 11.5 Strip unwanted codes the_content of Frontpage
730
  add_action( 'template_redirect', 'ampforwp_remove_print_scripts' );
731
 
732
  // 17. Archives Canonical in AMP version
733
+ // function ampforwp_rel_canonical_archive() {
734
+ //
735
+ // // $archivelink = esc_url( get_permalink( $id ) . AMP_QUERY_VAR . '/' );
736
+ // echo "<link rel='canonical' href='$current_archive_url' />\n";
737
+ // }
738
+ // add_action( 'amp_post_template_head', 'ampforwp_rel_canonical_archive' );
 
 
 
739
 
740
  // 18. Custom Canonical for Homepage
741
+ // function ampforwp_rel_canonical() {
742
+ // if ( !is_home() )
743
+ // return;
744
+ // // $link = esc_url( get_permalink( $id ) . AMP_QUERY_VAR . '/' );
745
+ // $homelink = get_home_url();
746
+ // echo "<link rel='canonical' href='$homelink' />\n";
747
+ // }
748
+ // add_action( 'amp_post_template_head', 'ampforwp_rel_canonical' );
749
 
750
  // 18.5. Custom Canonical for Frontpage
751
+ // function ampforwp_rel_canonical_frontpage() {
752
  // if ( is_home() || is_front_page() )
753
  // return;
754
+ // // $link = esc_url( get_permalink( $id ) . AMP_QUERY_VAR . '/' );
755
  // $homelink = get_home_url();
756
  // echo "<link rel='canonical' href='$homelink' />\n";
757
+ // }
758
+ // add_action( 'amp_post_template_head', 'ampforwp_rel_canonical_frontpage' );
759
 
760
  // 19. Remove Canonical tags
761
  function ampforwp_amp_remove_actions() {
803
  <amp-social-share type="facebook" data-param-app_id="<?php echo $redux_builder_amp['amp-facebook-app-id']; ?>" width="50" height="28"></amp-social-share>
804
  <?php } ?>
805
  <?php if($redux_builder_amp['enable-single-twitter-share'] == true) { ?>
806
+ <amp-social-share type="twitter"
807
+ width="50"
808
+ height="28"
809
+ data-param-url="CANONICAL_URL"
810
+ ></amp-social-share>
811
  <?php } ?>
812
  <?php if($redux_builder_amp['enable-single-gplus-share'] == true) { ?>
813
  <amp-social-share type="gplus" width="50" height="28"></amp-social-share>
887
  $title = $post->post_title;
888
  echo $title . ' | ' . get_option( 'blogname' ) ;
889
  }
 
 
 
 
 
 
 
 
 
890
 
891
+ $site_title = get_bloginfo('name') . ' | ' . get_option( 'blogdescription' ) ;
892
+ if ( is_home() ) {
893
+ if ( $redux_builder_amp['amp-frontpage-select-option']== 1) {
894
+ $ID = $redux_builder_amp['amp-frontpage-select-option-pages'];
895
+ $site_title = get_the_title( $ID ) . ' | ' . get_option('blogname');
896
  }
897
+ echo $site_title ;
898
+ } ?>
 
 
 
899
  </title>
900
  <?php
901
  }
902
  }
903
  //End of 26
904
+
905
+
906
+ // 27.
907
+ add_filter( 'amp_skip_post', 'ampforwp_skip_amp_post', 10, 3 );
908
+
909
+ function ampforwp_skip_amp_post( $skip, $post_id, $post ) {
910
+ $ampforwp_amp_post_on_off_meta = get_post_meta( $post->ID );
911
+ if( $ampforwp_amp_post_on_off_meta['ampforwp-amp-on-off'][0] === 'hide-amp' ) {
912
+ $skip = true;
913
+ }
914
+ return $skip;
915
+ }