AMP for WP – Accelerated Mobile Pages - Version 0.9.35

Version Description

  • Full details at https://ampforwp.com/page-builder-realtime-preview-3rd-party-plugins-compatibility/
  • Customizer page builder (Design Manager) was not showing real-time preview, we have fixed this issue properly [Bug fix]
  • Attachment page was having the wrong endpoint. [Bug fix]
  • Fb:like div has href, showfaces, send and action tag, which was against validation [Validation Improvement]
  • A plugin (Spam Protection by CleanTalk, no Captcha Anti-Spam) was forcefully adding script into the AMP version. [3rd party Compatibility]
  • Lang attributes were added [Enhancement]
  • The tag like was disallowed in the AMP [Validation Improvement]
  • We did some more testing with Visual Composer & AMP [3rd party Compatibility]
  • AMP on Pages option was not working in some cases. [Bug fix]
  • Disable comment button when comments were disabled. This was fixed by @lofesa and was sent as a pull request. Thank you Lofesa!
  • g:plusone tag was not getting removed properly. [Validation Improvement]
  • Thrive headline optimizer was having issues in AMP version. [Validation Improvement]
  • Structured Data Image width issue solved [Enhancement]
  • BJ Lazy Load was having issues, we have added a fix which will make this plugin compatible with the AMP. [3rd party Compatibility & Validation Improvement]
  • imageanchor=1 was getting added by some 3rd party plugin, this was fixed.[Validation Improvement]
Download this release

Release Info

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

Code changes from version 0.9.34 to 0.9.35

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.34
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: http://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/5
@@ -15,10 +15,9 @@ if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
  // Rewrite the Endpoints after the plugin is activate, as priority is set to 11
17
  function ampforwp_add_custom_post_support() {
18
-
19
- add_rewrite_endpoint( AMP_QUERY_VAR, EP_PERMALINK | EP_PAGES | EP_ROOT );
20
  global $redux_builder_amp;
21
- if($redux_builder_amp['amp-on-off-for-all-pages']){
 
22
  add_post_type_support( 'page', AMP_QUERY_VAR );
23
  }
24
  }
@@ -26,7 +25,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.34');
30
  /*
31
  * Load Files only in the backend
32
  * As we don't need plugin activation code to run everytime the site loads
@@ -182,7 +181,7 @@ function ampforwp_page_template_redirect_archive() {
182
  // Add Custom Rewrite Rule to make sure pagination & redirection is working correctly
183
  function ampforwp_add_custom_rewrite_rules() {
184
  add_rewrite_rule(
185
- 'amp/page/([0-9]{1,})/?$',
186
  'index.php?amp&paged=$matches[1]',
187
  'top'
188
  );
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.35
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: http://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/5
15
 
16
  // Rewrite the Endpoints after the plugin is activate, as priority is set to 11
17
  function ampforwp_add_custom_post_support() {
 
 
18
  global $redux_builder_amp;
19
+ if( $redux_builder_amp['amp-on-off-for-all-pages'] ) {
20
+ add_rewrite_endpoint( AMP_QUERY_VAR, EP_PERMALINK | EP_PAGES | EP_ROOT );
21
  add_post_type_support( 'page', AMP_QUERY_VAR );
22
  }
23
  }
25
 
26
  define('AMPFORWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
27
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
28
+ define('AMPFORWP_VERSION','0.9.35');
29
  /*
30
  * Load Files only in the backend
31
  * As we don't need plugin activation code to run everytime the site loads
181
  // Add Custom Rewrite Rule to make sure pagination & redirection is working correctly
182
  function ampforwp_add_custom_rewrite_rules() {
183
  add_rewrite_rule(
184
+ 'amp/page/([0-9]{1,})/?$',
185
  'index.php?amp&paged=$matches[1]',
186
  'top'
187
  );
includes/options/options-init.php CHANGED
@@ -297,6 +297,7 @@
297
  'title' => __('AMP on Pages', 'redux-framework-demo'),
298
  'subtitle' => __('Enable or Disable AMP on all Pages', 'redux-framework-demo'),
299
  'default' => 1,
 
300
  ),
301
  array(
302
  'id' =>'amp-on-off-support-for-non-amp-home-page',
297
  'title' => __('AMP on Pages', 'redux-framework-demo'),
298
  'subtitle' => __('Enable or Disable AMP on all Pages', 'redux-framework-demo'),
299
  'default' => 1,
300
+ 'desc' => __( 'Re-Save permalink if you make changes in this option', 'redux-framework-demo' ),
301
  ),
302
  array(
303
  'id' =>'amp-on-off-support-for-non-amp-home-page',
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.34
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -122,6 +122,23 @@ You can contact me using this url: http://ampforwp.com/contact/
122
 
123
  == Changelog ==
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  = 0.9.34 =
126
  * Newspaper theme by Tagdiv was having issues, we have fixed this one.
127
 
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.35
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
122
 
123
  == Changelog ==
124
 
125
+ = 0.9.35 =
126
+ * Full details at https://ampforwp.com/page-builder-realtime-preview-3rd-party-plugins-compatibility/
127
+ * Customizer page builder (Design Manager) was not showing real-time preview, we have fixed this issue properly [Bug fix]
128
+ * Attachment page was having the wrong endpoint. [Bug fix]
129
+ * Fb:like div has href, showfaces, send and action tag, which was against validation [Validation Improvement]
130
+ * A plugin (Spam Protection by CleanTalk, no Captcha Anti-Spam) was forcefully adding script into the AMP version. [3rd party Compatibility]
131
+ * Lang attributes were added [Enhancement]
132
+ * The tag like was disallowed in the AMP [Validation Improvement]
133
+ * We did some more testing with Visual Composer & AMP [3rd party Compatibility]
134
+ * AMP on Pages option was not working in some cases. [Bug fix]
135
+ * Disable comment button when comments were disabled. This was fixed by @lofesa and was sent as a pull request. Thank you Lofesa!
136
+ * g:plusone tag was not getting removed properly. [Validation Improvement]
137
+ * Thrive headline optimizer was having issues in AMP version. [Validation Improvement]
138
+ * Structured Data Image width issue solved [Enhancement]
139
+ * BJ Lazy Load was having issues, we have added a fix which will make this plugin compatible with the AMP. [3rd party Compatibility & Validation Improvement]
140
+ * imageanchor=”1″ was getting added by some 3rd party plugin, this was fixed.[Validation Improvement]
141
+
142
  = 0.9.34 =
143
  * Newspaper theme by Tagdiv was having issues, we have fixed this one.
144
 
templates/design-manager.php CHANGED
@@ -9,6 +9,7 @@ if ( is_customize_preview() ) {
9
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_social_icons' );
10
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_comments' );
11
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_related_posts' );
 
12
  }
13
 
14
  $data = get_option( 'ampforwp_design' );
@@ -50,6 +51,9 @@ if ( is_customize_preview() ) {
50
  case 'related_posts:1':
51
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_related_posts' );
52
  break;
 
 
 
53
  }
54
  }
55
  }
@@ -78,7 +82,7 @@ function ampforwp_stylesheet_file_insertion() {
78
  } else {
79
  $ampforwp_design_selector = ampforwp_design_selector();
80
  }
81
-
82
  // Add StyleSheet
83
  require AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. $ampforwp_design_selector . '/style.php';
84
  }
@@ -189,6 +193,20 @@ function ampforwp_design_element_comments( $file, $type, $post ) {
189
  return $file;
190
  }
191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  // Related Posts
193
  function ampforwp_add_element_related_posts( $meta_parts ) {
194
  $meta_parts[] = 'ampforwp-related-posts';
9
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_social_icons' );
10
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_comments' );
11
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_related_posts' );
12
+ // add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_simple_comment_button' );
13
  }
14
 
15
  $data = get_option( 'ampforwp_design' );
51
  case 'related_posts:1':
52
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_related_posts' );
53
  break;
54
+ case 'comments:0':
55
+ add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_simple_comment_button' );
56
+ break;
57
  }
58
  }
59
  }
82
  } else {
83
  $ampforwp_design_selector = ampforwp_design_selector();
84
  }
85
+
86
  // Add StyleSheet
87
  require AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. $ampforwp_design_selector . '/style.php';
88
  }
193
  return $file;
194
  }
195
 
196
+ // simple comment button
197
+ function ampforwp_add_element_simple_comment_button( $meta_parts ) {
198
+ $meta_parts[] = 'ampforwp-simple-comment-button';
199
+ return $meta_parts;
200
+ }
201
+ add_filter( 'amp_post_template_file', 'ampforwp_design_element_simple_comment_button', 10, 3 );
202
+
203
+ function ampforwp_design_element_simple_comment_button( $file, $type, $post ) {
204
+ if ( 'ampforwp-simple-comment-button' === $type ) {
205
+ $file = AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. ampforwp_design_selector() .'/elements/simple-comment-button.php';
206
+ }
207
+ return $file;
208
+ }
209
+
210
  // Related Posts
211
  function ampforwp_add_element_related_posts( $meta_parts ) {
212
  $meta_parts[] = 'ampforwp-related-posts';
templates/design-manager/design-1/elements/comments.php CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  <div class="ampforwp-comment-wrapper">
2
  <?php
3
  global $redux_builder_amp;
@@ -62,5 +67,13 @@
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>
65
- <?php } ?>
 
 
 
 
 
 
 
 
66
  </div>
1
+ <?php
2
+ if (!comments_open()) {
3
+ return;
4
+ }
5
+ ?>
6
  <div class="ampforwp-comment-wrapper">
7
  <?php
8
  global $redux_builder_amp;
67
  <div class="comment-button-wrapper">
68
  <a href="<?php echo get_permalink().'#commentform' ?>"><?php esc_html_e( $redux_builder_amp['amp-translator-leave-a-comment-text'] ); ?></a>
69
  </div>
70
+ <?php } else {
71
+ global $redux_builder_amp ;
72
+ if (!comments_open()) {
73
+ return;
74
+ } ?>
75
+ <div class="comment-button-wrapper">
76
+ <a href="<?php echo get_permalink().'#commentform' ?>"><?php esc_html_e( $redux_builder_amp['amp-translator-leave-a-comment-text'] ); ?></a>
77
+ </div>
78
+ <?php } ?>
79
  </div>
templates/design-manager/design-1/elements/simple-comment-button.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ global $redux_builder_amp ; ?>
3
+ <?php if( !comments_open() ) { return; } ?>
4
+ <div class="comment-button-wrapper ampforwp-comment-button">
5
+ <a href="<?php echo get_permalink().'#commentform' ?>"><?php esc_html_e( $redux_builder_amp['amp-translator-leave-a-comment-text'] ); ?></a>
6
+ </div>
templates/design-manager/design-1/frontpage.php CHANGED
@@ -2,7 +2,7 @@
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 ) ?>">
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 <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
6
  <head>
7
  <meta charset="utf-8">
8
  <link rel="canonical" href="<?php echo get_permalink( $post_id ) ?>">
templates/design-manager/design-1/single.php CHANGED
@@ -19,27 +19,7 @@
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
 
@@ -50,9 +30,3 @@
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 }
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
 
30
  </body>
31
  </html>
32
 
 
 
 
 
 
 
templates/design-manager/design-1/style.php CHANGED
@@ -18,35 +18,28 @@ function ampforwp_additional_style_input( $amp_template ) {
18
  $header_color = $get_customizer->get_customizer_setting( 'header_color' );
19
  ?>
20
  /* Generic WP styling */
21
-
22
  .alignright {
23
  float: right;
24
  }
25
-
26
  .alignleft {
27
  float: left;
28
  }
29
-
30
  .aligncenter {
31
  display: block;
32
  margin-left: auto;
33
  margin-right: auto;
34
  }
35
-
36
  .amp-wp-enforced-sizes {
37
  /** Our sizes fallback is 100vw, and we have a padding on the container; the max-width here prevents the element from overflowing. **/
38
  max-width: 100%;
39
  margin: 0 auto;
40
  }
41
-
42
  .amp-wp-unknown-size img {
43
  /** Worst case scenario when we can't figure out dimensions for an image. **/
44
  /** Force the image into a box of fixed dimensions and use object-fit to scale. **/
45
  object-fit: contain;
46
  }
47
-
48
  /* Template Styles */
49
-
50
  .amp-wp-content,
51
  .amp-wp-title-bar div {
52
  <?php if ( $content_max_width > 0 ) : ?>
@@ -54,11 +47,9 @@ function ampforwp_additional_style_input( $amp_template ) {
54
  max-width: <?php echo sprintf( '%dpx', $content_max_width ); ?>;
55
  <?php endif; ?>
56
  }
57
-
58
  html {
59
  background: <?php echo sanitize_hex_color( $header_background_color ); ?>;
60
  }
61
-
62
  body {
63
  background: <?php echo sanitize_hex_color( $theme_color ); ?>;
64
  color: <?php echo sanitize_hex_color( $text_color ); ?>;
@@ -66,7 +57,6 @@ body {
66
  font-weight: 300;
67
  line-height: 1.75em;
68
  }
69
-
70
  p,
71
  ol,
72
  ul,
@@ -74,20 +64,16 @@ figure {
74
  margin: 0 0 1em;
75
  padding: 0;
76
  }
77
-
78
  a,
79
  a:visited {
80
  color: <?php echo sanitize_hex_color( $link_color ); ?>;
81
  }
82
-
83
  a:hover,
84
  a:active,
85
  a:focus {
86
  color: <?php echo sanitize_hex_color( $text_color ); ?>;
87
  }
88
-
89
  /* Quotes */
90
-
91
  blockquote {
92
  color: <?php echo sanitize_hex_color( $text_color ); ?>;
93
  background: rgba(127,127,127,.125);
@@ -95,13 +81,10 @@ blockquote {
95
  margin: 8px 0 24px 0;
96
  padding: 16px;
97
  }
98
-
99
  blockquote p:last-child {
100
  margin-bottom: 0;
101
  }
102
-
103
  /* UI Fonts */
104
-
105
  .amp-wp-meta,
106
  .amp-wp-header div,
107
  .amp-wp-title,
@@ -113,13 +96,10 @@ blockquote p:last-child {
113
  .back-to-top {
114
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif;
115
  }
116
-
117
  /* Header */
118
-
119
  .amp-wp-header {
120
  background-color: <?php echo sanitize_hex_color( $header_background_color ); ?>;
121
  }
122
-
123
  .amp-wp-header div {
124
  color: <?php echo sanitize_hex_color( $header_color ); ?>;
125
  font-size: 1em;
@@ -129,14 +109,11 @@ blockquote p:last-child {
129
  padding: .875em 16px;
130
  position: relative;
131
  }
132
-
133
  .amp-wp-header a {
134
  color: <?php echo sanitize_hex_color( $header_color ); ?>;
135
  text-decoration: none;
136
  }
137
-
138
  /* Site Icon */
139
-
140
  .amp-wp-header .amp-wp-site-icon {
141
  /** site icon is 32px **/
142
  background-color: <?php echo sanitize_hex_color( $header_color ); ?>;
@@ -146,9 +123,7 @@ blockquote p:last-child {
146
  right: 18px;
147
  top: 10px;
148
  }
149
-
150
  /* Article */
151
-
152
  .amp-wp-article {
153
  color: <?php echo sanitize_hex_color( $text_color ); ?>;
154
  font-weight: 400;
@@ -157,9 +132,7 @@ blockquote p:last-child {
157
  overflow-wrap: break-word;
158
  word-wrap: break-word;
159
  }
160
-
161
  /* Article Header */
162
-
163
  .amp-wp-article-header {
164
  align-items: center;
165
  align-content: stretch;
@@ -176,9 +149,7 @@ blockquote p:last-child {
176
  margin: 0;
177
  width: 100%;
178
  }
179
-
180
  /* Article Meta */
181
-
182
  .amp-wp-meta {
183
  color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;
184
  display: inline-block;
@@ -194,30 +165,24 @@ blockquote p:last-child {
194
  .amp-wp-article-header .amp-wp-meta:last-of-type {
195
  text-align: right;
196
  }
197
-
198
  .amp-wp-article-header .amp-wp-meta:first-of-type {
199
  text-align: left;
200
  }
201
-
202
  .amp-wp-byline amp-img,
203
  .amp-wp-byline .amp-wp-author {
204
  display: inline-block;
205
  vertical-align: middle;
206
  }
207
-
208
  .amp-wp-byline amp-img {
209
  border: 1px solid <?php echo sanitize_hex_color( $link_color ); ?>;
210
  border-radius: 50%;
211
  position: relative;
212
  margin-right: 6px;
213
  }
214
-
215
  .amp-wp-posted-on {
216
  text-align: right;
217
  }
218
-
219
  /* Featured image */
220
-
221
  .amp-wp-article-featured-image {
222
  margin: 1.5em 16px 1.5em;
223
  }
@@ -241,38 +206,29 @@ blockquote p:last-child {
241
  .amp-wp-article-content {
242
  margin: 0 16px;
243
  }
244
-
245
  .amp-wp-article-content ul,
246
  .amp-wp-article-content ol {
247
  margin-left: 1em;
248
  }
249
-
250
  .amp-wp-article-content amp-img {
251
  margin: 0 auto;
252
  }
253
-
254
  .amp-wp-article-content amp-img.alignright {
255
  margin: 0 0 1em 16px;
256
  }
257
-
258
  .amp-wp-article-content amp-img.alignleft {
259
  margin: 0 16px 1em 0;
260
  }
261
-
262
  /* Captions */
263
-
264
  .wp-caption {
265
  padding: 0;
266
  }
267
-
268
  .wp-caption.alignleft {
269
  margin-right: 16px;
270
  }
271
-
272
  .wp-caption.alignright {
273
  margin-left: 16px;
274
  }
275
-
276
  .wp-caption-text {
277
  border-bottom: 1px solid <?php echo sanitize_hex_color( $border_color ); ?>;
278
  color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;
@@ -282,9 +238,7 @@ blockquote p:last-child {
282
  padding: .66em 10px .75em;
283
  text-align: center;
284
  }
285
-
286
  /* AMP Media */
287
-
288
  amp-carousel {
289
  background: <?php echo sanitize_hex_color( $border_color ); ?>;
290
  margin: 0 -16px 1.5em;
@@ -296,23 +250,18 @@ amp-vine {
296
  background: <?php echo sanitize_hex_color( $border_color ); ?>;
297
  margin: 0 -16px 1.5em;
298
  }
299
-
300
  .amp-wp-article-content amp-carousel amp-img {
301
  border: none;
302
  }
303
-
304
  amp-carousel > amp-img > img {
305
  object-fit: contain;
306
  }
307
-
308
  .amp-wp-iframe-placeholder {
309
  background: <?php echo sanitize_hex_color( $border_color ); ?> url( <?php echo esc_url( $get_customizer->get( 'placeholder_image_url' ) ); ?> ) no-repeat center 40%;
310
  background-size: 48px 48px;
311
  min-height: 48px;
312
  }
313
-
314
  /* Article Footer Meta */
315
-
316
  .amp-wp-article-footer .amp-wp-meta {
317
  display: block;
318
  }
@@ -326,7 +275,9 @@ amp-carousel > amp-img > img {
326
  line-height: 1.5em;
327
  margin: 1.5em 16px;
328
  }
329
-
 
 
330
  .amp-wp-comments-link {
331
  color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;
332
  font-size: .875em;
@@ -334,7 +285,6 @@ amp-carousel > amp-img > img {
334
  text-align: center;
335
  margin: 2.25em 0 1.5em;
336
  }
337
-
338
  .amp-wp-comments-link a {
339
  border-style: solid;
340
  border-color: <?php echo sanitize_hex_color( $border_color ); ?>;
@@ -353,44 +303,36 @@ amp-carousel > amp-img > img {
353
  text-decoration: none;
354
  width: 50%;
355
  -webkit-transition: background-color 0.2s ease;
356
- transition: background-color 0.2s ease;
357
  }
358
-
359
  /* AMP Footer */
360
-
361
  .amp-wp-footer {
362
  border-top: 1px solid <?php echo sanitize_hex_color( $border_color ); ?>;
363
  margin: calc(1.5em - 1px) 0 0;
364
  padding-bottom:25px;
365
  }
366
-
367
  .amp-wp-footer div {
368
  margin: 0 auto;
369
  max-width: calc(840px - 32px);
370
  padding: 1.25em 16px 1.25em;
371
  position: relative;
372
  }
373
-
374
  .amp-wp-footer h2 {
375
  font-size: 1em;
376
  line-height: 1.375em;
377
  margin: 0 0 .5em;
378
  }
379
-
380
  .amp-wp-footer p {
381
  color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;
382
  font-size: .8em;
383
  line-height: 1.5em;
384
  margin: 0 15px 0 0;
385
  }
386
-
387
  .amp-wp-footer a {
388
  text-decoration: none;
389
  }
390
  .copyright_txt{ float:left }
391
  .back-to-top { float:right }
392
-
393
-
394
  /* Header */
395
  .amp-wp-header {
396
  }
@@ -426,10 +368,10 @@ amp-carousel > amp-img > img {
426
  .amp-wp-home .amp-wp-meta{
427
  margin:5px 0px
428
  }
429
- .amp-wp-home .amp-wp-content p {
430
- display: inline-block;
431
- width: 100%;
432
- }
433
  .ampforwp-custom-index .amp-wp-title a {
434
  text-decoration: none;
435
  color: <?php echo sanitize_hex_color( $text_color ); ?>;
@@ -457,13 +399,10 @@ amp-carousel > amp-img > img {
457
  .amp-wp-home .amp-wp-content p {
458
  display: inline;
459
  }
460
-
461
  .home-post-image {
462
  float: right ;
463
  margin: 0 0 10px 20px;
464
-
465
  }
466
-
467
  /* Single */
468
  .amp-wp-article-content amp-img {
469
  max-width : 100%;
@@ -532,7 +471,7 @@ amp-carousel > amp-img > img {
532
  margin:0;
533
  padding:0;
534
  font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif
535
- }
536
  .related_posts ol li{
537
  display:inline-block;
538
  width:100%;
@@ -557,7 +496,6 @@ amp-carousel > amp-img > img {
557
  .no_related_thumbnail{
558
  padding: 15px 18px;
559
  }
560
-
561
  /* Comments */
562
  .comments_list{
563
  margin: 2.5em 16px 2.5em
@@ -613,7 +551,7 @@ amp-carousel > amp-img > img {
613
  .comment-author{ float:left }
614
  .single-post footer.comment-meta{
615
  /* float:right */
616
- padding-bottom: 0;
617
  }
618
  .comments_list li li{
619
  margin: 20px 20px 10px 20px;
@@ -624,7 +562,6 @@ amp-carousel > amp-img > img {
624
  .comments_list li li li{
625
  margin:20px 20px 10px 20px
626
  }
627
-
628
  /* Slide Navigation code */
629
  amp-sidebar {
630
  width: 250px;
@@ -712,7 +649,6 @@ amp-carousel > amp-img > img {
712
  display: inline-block;
713
  width: 100%;
714
  }
715
-
716
  /* Notifications */
717
  #amp-user-notification1 p {
718
  display: inline-block;
@@ -733,7 +669,6 @@ amp-carousel > amp-img > img {
733
  amp-user-notification button:hover {
734
  cursor: pointer
735
  }
736
-
737
  /* Advertisement */
738
  .amp-ad-wrapper {
739
  text-align: center
@@ -779,21 +714,17 @@ amp-carousel > amp-img > img {
779
  .amp-wp-tax-tag span:last-child:after {
780
  content: ' ';
781
  }
782
-
783
  pre {
784
- white-space: pre-wrap;
785
  }
786
-
787
  <?php if($redux_builder_amp['enable-single-social-icons']){ ?>
788
  .amp-wp-footer {
789
  padding-bottom: 60px;
790
  }
791
  <?php } ?>
792
-
793
  .amp-ad-wrapper.amp_ad_1 {
794
  padding-top : 20px;
795
  }
796
-
797
- /* Custom Style Code */
798
  <?php echo $redux_builder_amp['css_editor'];
799
- } ?>
18
  $header_color = $get_customizer->get_customizer_setting( 'header_color' );
19
  ?>
20
  /* Generic WP styling */
 
21
  .alignright {
22
  float: right;
23
  }
 
24
  .alignleft {
25
  float: left;
26
  }
 
27
  .aligncenter {
28
  display: block;
29
  margin-left: auto;
30
  margin-right: auto;
31
  }
 
32
  .amp-wp-enforced-sizes {
33
  /** Our sizes fallback is 100vw, and we have a padding on the container; the max-width here prevents the element from overflowing. **/
34
  max-width: 100%;
35
  margin: 0 auto;
36
  }
 
37
  .amp-wp-unknown-size img {
38
  /** Worst case scenario when we can't figure out dimensions for an image. **/
39
  /** Force the image into a box of fixed dimensions and use object-fit to scale. **/
40
  object-fit: contain;
41
  }
 
42
  /* Template Styles */
 
43
  .amp-wp-content,
44
  .amp-wp-title-bar div {
45
  <?php if ( $content_max_width > 0 ) : ?>
47
  max-width: <?php echo sprintf( '%dpx', $content_max_width ); ?>;
48
  <?php endif; ?>
49
  }
 
50
  html {
51
  background: <?php echo sanitize_hex_color( $header_background_color ); ?>;
52
  }
 
53
  body {
54
  background: <?php echo sanitize_hex_color( $theme_color ); ?>;
55
  color: <?php echo sanitize_hex_color( $text_color ); ?>;
57
  font-weight: 300;
58
  line-height: 1.75em;
59
  }
 
60
  p,
61
  ol,
62
  ul,
64
  margin: 0 0 1em;
65
  padding: 0;
66
  }
 
67
  a,
68
  a:visited {
69
  color: <?php echo sanitize_hex_color( $link_color ); ?>;
70
  }
 
71
  a:hover,
72
  a:active,
73
  a:focus {
74
  color: <?php echo sanitize_hex_color( $text_color ); ?>;
75
  }
 
76
  /* Quotes */
 
77
  blockquote {
78
  color: <?php echo sanitize_hex_color( $text_color ); ?>;
79
  background: rgba(127,127,127,.125);
81
  margin: 8px 0 24px 0;
82
  padding: 16px;
83
  }
 
84
  blockquote p:last-child {
85
  margin-bottom: 0;
86
  }
 
87
  /* UI Fonts */
 
88
  .amp-wp-meta,
89
  .amp-wp-header div,
90
  .amp-wp-title,
96
  .back-to-top {
97
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif;
98
  }
 
99
  /* Header */
 
100
  .amp-wp-header {
101
  background-color: <?php echo sanitize_hex_color( $header_background_color ); ?>;
102
  }
 
103
  .amp-wp-header div {
104
  color: <?php echo sanitize_hex_color( $header_color ); ?>;
105
  font-size: 1em;
109
  padding: .875em 16px;
110
  position: relative;
111
  }
 
112
  .amp-wp-header a {
113
  color: <?php echo sanitize_hex_color( $header_color ); ?>;
114
  text-decoration: none;
115
  }
 
116
  /* Site Icon */
 
117
  .amp-wp-header .amp-wp-site-icon {
118
  /** site icon is 32px **/
119
  background-color: <?php echo sanitize_hex_color( $header_color ); ?>;
123
  right: 18px;
124
  top: 10px;
125
  }
 
126
  /* Article */
 
127
  .amp-wp-article {
128
  color: <?php echo sanitize_hex_color( $text_color ); ?>;
129
  font-weight: 400;
132
  overflow-wrap: break-word;
133
  word-wrap: break-word;
134
  }
 
135
  /* Article Header */
 
136
  .amp-wp-article-header {
137
  align-items: center;
138
  align-content: stretch;
149
  margin: 0;
150
  width: 100%;
151
  }
 
152
  /* Article Meta */
 
153
  .amp-wp-meta {
154
  color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;
155
  display: inline-block;
165
  .amp-wp-article-header .amp-wp-meta:last-of-type {
166
  text-align: right;
167
  }
 
168
  .amp-wp-article-header .amp-wp-meta:first-of-type {
169
  text-align: left;
170
  }
 
171
  .amp-wp-byline amp-img,
172
  .amp-wp-byline .amp-wp-author {
173
  display: inline-block;
174
  vertical-align: middle;
175
  }
 
176
  .amp-wp-byline amp-img {
177
  border: 1px solid <?php echo sanitize_hex_color( $link_color ); ?>;
178
  border-radius: 50%;
179
  position: relative;
180
  margin-right: 6px;
181
  }
 
182
  .amp-wp-posted-on {
183
  text-align: right;
184
  }
 
185
  /* Featured image */
 
186
  .amp-wp-article-featured-image {
187
  margin: 1.5em 16px 1.5em;
188
  }
206
  .amp-wp-article-content {
207
  margin: 0 16px;
208
  }
 
209
  .amp-wp-article-content ul,
210
  .amp-wp-article-content ol {
211
  margin-left: 1em;
212
  }
 
213
  .amp-wp-article-content amp-img {
214
  margin: 0 auto;
215
  }
 
216
  .amp-wp-article-content amp-img.alignright {
217
  margin: 0 0 1em 16px;
218
  }
 
219
  .amp-wp-article-content amp-img.alignleft {
220
  margin: 0 16px 1em 0;
221
  }
 
222
  /* Captions */
 
223
  .wp-caption {
224
  padding: 0;
225
  }
 
226
  .wp-caption.alignleft {
227
  margin-right: 16px;
228
  }
 
229
  .wp-caption.alignright {
230
  margin-left: 16px;
231
  }
 
232
  .wp-caption-text {
233
  border-bottom: 1px solid <?php echo sanitize_hex_color( $border_color ); ?>;
234
  color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;
238
  padding: .66em 10px .75em;
239
  text-align: center;
240
  }
 
241
  /* AMP Media */
 
242
  amp-carousel {
243
  background: <?php echo sanitize_hex_color( $border_color ); ?>;
244
  margin: 0 -16px 1.5em;
250
  background: <?php echo sanitize_hex_color( $border_color ); ?>;
251
  margin: 0 -16px 1.5em;
252
  }
 
253
  .amp-wp-article-content amp-carousel amp-img {
254
  border: none;
255
  }
 
256
  amp-carousel > amp-img > img {
257
  object-fit: contain;
258
  }
 
259
  .amp-wp-iframe-placeholder {
260
  background: <?php echo sanitize_hex_color( $border_color ); ?> url( <?php echo esc_url( $get_customizer->get( 'placeholder_image_url' ) ); ?> ) no-repeat center 40%;
261
  background-size: 48px 48px;
262
  min-height: 48px;
263
  }
 
264
  /* Article Footer Meta */
 
265
  .amp-wp-article-footer .amp-wp-meta {
266
  display: block;
267
  }
275
  line-height: 1.5em;
276
  margin: 1.5em 16px;
277
  }
278
+ .ampforwp-comment-button {
279
+ margin-bottom:20px;
280
+ }
281
  .amp-wp-comments-link {
282
  color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;
283
  font-size: .875em;
285
  text-align: center;
286
  margin: 2.25em 0 1.5em;
287
  }
 
288
  .amp-wp-comments-link a {
289
  border-style: solid;
290
  border-color: <?php echo sanitize_hex_color( $border_color ); ?>;
303
  text-decoration: none;
304
  width: 50%;
305
  -webkit-transition: background-color 0.2s ease;
306
+ transition: background-color 0.2s ease;
307
  }
 
308
  /* AMP Footer */
 
309
  .amp-wp-footer {
310
  border-top: 1px solid <?php echo sanitize_hex_color( $border_color ); ?>;
311
  margin: calc(1.5em - 1px) 0 0;
312
  padding-bottom:25px;
313
  }
 
314
  .amp-wp-footer div {
315
  margin: 0 auto;
316
  max-width: calc(840px - 32px);
317
  padding: 1.25em 16px 1.25em;
318
  position: relative;
319
  }
 
320
  .amp-wp-footer h2 {
321
  font-size: 1em;
322
  line-height: 1.375em;
323
  margin: 0 0 .5em;
324
  }
 
325
  .amp-wp-footer p {
326
  color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;
327
  font-size: .8em;
328
  line-height: 1.5em;
329
  margin: 0 15px 0 0;
330
  }
 
331
  .amp-wp-footer a {
332
  text-decoration: none;
333
  }
334
  .copyright_txt{ float:left }
335
  .back-to-top { float:right }
 
 
336
  /* Header */
337
  .amp-wp-header {
338
  }
368
  .amp-wp-home .amp-wp-meta{
369
  margin:5px 0px
370
  }
371
+ .amp-wp-home .amp-wp-content p {
372
+ display: inline-block;
373
+ width: 100%;
374
+ }
375
  .ampforwp-custom-index .amp-wp-title a {
376
  text-decoration: none;
377
  color: <?php echo sanitize_hex_color( $text_color ); ?>;
399
  .amp-wp-home .amp-wp-content p {
400
  display: inline;
401
  }
 
402
  .home-post-image {
403
  float: right ;
404
  margin: 0 0 10px 20px;
 
405
  }
 
406
  /* Single */
407
  .amp-wp-article-content amp-img {
408
  max-width : 100%;
471
  margin:0;
472
  padding:0;
473
  font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif
474
+ }
475
  .related_posts ol li{
476
  display:inline-block;
477
  width:100%;
496
  .no_related_thumbnail{
497
  padding: 15px 18px;
498
  }
 
499
  /* Comments */
500
  .comments_list{
501
  margin: 2.5em 16px 2.5em
551
  .comment-author{ float:left }
552
  .single-post footer.comment-meta{
553
  /* float:right */
554
+ padding-bottom: 0;
555
  }
556
  .comments_list li li{
557
  margin: 20px 20px 10px 20px;
562
  .comments_list li li li{
563
  margin:20px 20px 10px 20px
564
  }
 
565
  /* Slide Navigation code */
566
  amp-sidebar {
567
  width: 250px;
649
  display: inline-block;
650
  width: 100%;
651
  }
 
652
  /* Notifications */
653
  #amp-user-notification1 p {
654
  display: inline-block;
669
  amp-user-notification button:hover {
670
  cursor: pointer
671
  }
 
672
  /* Advertisement */
673
  .amp-ad-wrapper {
674
  text-align: center
714
  .amp-wp-tax-tag span:last-child:after {
715
  content: ' ';
716
  }
 
717
  pre {
718
+ white-space: pre-wrap;
719
  }
 
720
  <?php if($redux_builder_amp['enable-single-social-icons']){ ?>
721
  .amp-wp-footer {
722
  padding-bottom: 60px;
723
  }
724
  <?php } ?>
 
725
  .amp-ad-wrapper.amp_ad_1 {
726
  padding-top : 20px;
727
  }
728
+ /* Custom Style Code */
 
729
  <?php echo $redux_builder_amp['css_editor'];
730
+ } ?>
templates/design-manager/design-2/elements/comments.php CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  <div class="ampforwp-comment-wrapper">
2
  <?php
3
  global $redux_builder_amp;
@@ -62,6 +67,13 @@
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>
1
+ <?php
2
+ if (!comments_open()) {
3
+ return;
4
+ }
5
+ ?>
6
  <div class="ampforwp-comment-wrapper">
7
  <?php
8
  global $redux_builder_amp;
67
  <div class="comment-button-wrapper">
68
  <a href="<?php echo get_permalink().'#commentform' ?>"><?php esc_html_e( $redux_builder_amp['amp-translator-leave-a-comment-text'] ); ?></a>
69
  </div><?php
70
+ } else {
71
+ global $redux_builder_amp ;
72
+ if (!comments_open()) {
73
+ return;
74
+ } ?>
75
+ <div class="comment-button-wrapper">
76
+ <a href="<?php echo get_permalink().'#commentform' ?>"><?php esc_html_e( $redux_builder_amp['amp-translator-leave-a-comment-text'] ); ?></a>
77
+ </div>
78
+ <?php } ?>
79
  </div>
templates/design-manager/design-2/elements/simple-comment-button.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ global $redux_builder_amp ; ?>
3
+ <?php if( !comments_open() ) { return; } ?>
4
+ <div class="comment-button-wrapper ampforwp-comment-button">
5
+ <a href="<?php echo get_permalink().'#commentform' ?>"><?php esc_html_e( $redux_builder_amp['amp-translator-leave-a-comment-text'] ); ?></a>
6
+ </div>
templates/design-manager/design-2/frontpage.php CHANGED
@@ -2,7 +2,7 @@
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
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 <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
6
  <head>
7
  <meta charset="utf-8">
8
  <link rel="canonical" href="<?php
templates/design-manager/design-2/index.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php global $redux_builder_amp; ?>
2
  <!doctype html>
3
- <html amp>
4
  <head>
5
  <meta charset="utf-8">
6
  <link rel="dns-prefetch" href="https://cdn.ampproject.org">
@@ -36,11 +36,11 @@
36
  $paged = 1;
37
  }
38
 
39
- $exclude_ids = get_option('ampforwp_exclude_post');
40
 
41
  $q = new WP_Query( array(
42
  'post_type' => 'post',
43
- 'orderby' => 'date',
44
  'offset' => esc_attr($fn_offset),
45
  'ignore_sticky_posts' => 1,
46
  'paged' => esc_attr($paged),
@@ -52,7 +52,7 @@
52
  the_archive_description( '<div class="taxonomy-description">', '</div>' );
53
  } ?>
54
 
55
- <?php if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post();
56
  $ampforwp_amp_post_url = trailingslashit( get_permalink() ) . AMP_QUERY_VAR ; ?>
57
 
58
  <div class="amp-wp-content amp-loop-list">
1
  <?php global $redux_builder_amp; ?>
2
  <!doctype html>
3
+ <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
4
  <head>
5
  <meta charset="utf-8">
6
  <link rel="dns-prefetch" href="https://cdn.ampproject.org">
36
  $paged = 1;
37
  }
38
 
39
+ $exclude_ids = get_option('ampforwp_exclude_post');
40
 
41
  $q = new WP_Query( array(
42
  'post_type' => 'post',
43
+ 'orderby' => 'date',
44
  'offset' => esc_attr($fn_offset),
45
  'ignore_sticky_posts' => 1,
46
  'paged' => esc_attr($paged),
52
  the_archive_description( '<div class="taxonomy-description">', '</div>' );
53
  } ?>
54
 
55
+ <?php if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post();
56
  $ampforwp_amp_post_url = trailingslashit( get_permalink() ) . AMP_QUERY_VAR ; ?>
57
 
58
  <div class="amp-wp-content amp-loop-list">
templates/design-manager/design-2/single.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php global $redux_builder_amp; ?>
2
  <!doctype html>
3
- <html amp>
4
  <head>
5
  <meta charset="utf-8">
6
  <link rel="dns-prefetch" href="https://cdn.ampproject.org">
@@ -20,26 +20,6 @@
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>
@@ -48,9 +28,3 @@ if($count === 0 && $comments_count->approved == 0) {
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 }
1
  <?php global $redux_builder_amp; ?>
2
  <!doctype html>
3
+ <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
4
  <head>
5
  <meta charset="utf-8">
6
  <link rel="dns-prefetch" href="https://cdn.ampproject.org">
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 do_action('ampforwp_post_after_design_elements') ?>
24
  </article>
25
  </main>
28
  </body>
29
  </html>
30
 
 
 
 
 
 
 
templates/design-manager/design-2/style.php CHANGED
@@ -270,8 +270,6 @@ h2.amp-wp-title , .amp-wp-post-content p{
270
  line-height: 20px;
271
  margin: 3px 0 0 5px;
272
  }
273
-
274
-
275
  /* Footer */
276
  #footer{
277
  background : #fff;
@@ -286,9 +284,6 @@ h2.amp-wp-title , .amp-wp-post-content p{
286
  #footer p{
287
  margin: 0
288
  }
289
-
290
-
291
-
292
  /* Single */
293
  .comment-button-wrapper{
294
  margin-bottom: 40px;
@@ -416,7 +411,6 @@ main .amp-wp-content.featured-image-content {
416
  margin: 10px auto;
417
  max-width: 1030px;
418
  }
419
-
420
  /* Related Posts */
421
  main .amp-wp-content.relatedpost {
422
  background: none;
@@ -477,7 +471,6 @@ main .amp-wp-content.relatedpost {
477
  .no_related_thumbnail .related_link{
478
  margin: 16px 18px 20px 19px;
479
  }
480
-
481
  /* Comments */
482
  .ampforwp-comment-wrapper{
483
  margin:1.8em 0px 1.5em 0px
@@ -542,7 +535,6 @@ main .amp-wp-content.comments_list {
542
  .comments_list li li li{
543
  margin:20px 20px 10px 20px
544
  }
545
-
546
  /* ADS */
547
  .amp_home_body .amp_ad_1{
548
  margin-top: 10px;
@@ -558,7 +550,6 @@ html .single-post .ampforwp-incontent-ad-1 {
558
  .amp-ad-4{
559
  margin-top:10px;
560
  }
561
-
562
  /* Notifications */
563
  #amp-user-notification1 p {
564
  display: inline-block;
@@ -586,9 +577,8 @@ amp-user-notification button:hover {
586
  padding: 15px 20px 8px 24px;
587
  background: #f3f3f3;
588
  }
589
-
590
  pre {
591
- white-space: pre-wrap;
592
  }
593
  /* Responsive */
594
  @media screen and (max-width: 800px) {
@@ -596,7 +586,6 @@ pre {
596
  padding: 12px 10px 10px 10px
597
  }
598
  }
599
-
600
  @media screen and (max-width: 630px) {
601
  .related_posts ol li p{
602
  display:none
@@ -719,7 +708,6 @@ pre {
719
  line-height: 26px;
720
  }
721
  }
722
-
723
  <?php if($redux_builder_amp['amp-rtl-select-option'] == true) { ?>
724
  /* RTL Start */
725
  .nav_container, .toggle-navigationv2, .amp-loop-list, #pagination, #footer, .amp-wp-meta, .amp-wp-title, .single-post .the_content, .amp-wp-tax-tag, .sticky_social{
@@ -792,15 +780,12 @@ amp-user-notification button {
792
  text-align:center;
793
  margin: 0 auto
794
  }
795
-
796
  .amp-wp-author:before{
797
  content: " <?php global $redux_builder_amp; echo $redux_builder_amp['amp-translator-by-text']; ?> ";
798
  }
799
-
800
  .ampforwp-tax-category span:first-child:after {
801
  content: ' ';
802
  }
803
-
804
  .ampforwp-tax-category span:after,
805
  .ampforwp-tax-tag span:after {
806
  content: ', ';
@@ -809,13 +794,10 @@ amp-user-notification button {
809
  .ampforwp-tax-tag span:last-child:after {
810
  content: ' ';
811
  }
812
-
813
- /* New V0.8.7(drag and drop) style */
814
  .amp-wp-article-content img {
815
  max-width: 100%;
816
  }
817
-
818
-
819
  /* Custom Style Code */
820
  <?php echo $redux_builder_amp['css_editor'];
821
  } ?>
270
  line-height: 20px;
271
  margin: 3px 0 0 5px;
272
  }
 
 
273
  /* Footer */
274
  #footer{
275
  background : #fff;
284
  #footer p{
285
  margin: 0
286
  }
 
 
 
287
  /* Single */
288
  .comment-button-wrapper{
289
  margin-bottom: 40px;
411
  margin: 10px auto;
412
  max-width: 1030px;
413
  }
 
414
  /* Related Posts */
415
  main .amp-wp-content.relatedpost {
416
  background: none;
471
  .no_related_thumbnail .related_link{
472
  margin: 16px 18px 20px 19px;
473
  }
 
474
  /* Comments */
475
  .ampforwp-comment-wrapper{
476
  margin:1.8em 0px 1.5em 0px
535
  .comments_list li li li{
536
  margin:20px 20px 10px 20px
537
  }
 
538
  /* ADS */
539
  .amp_home_body .amp_ad_1{
540
  margin-top: 10px;
550
  .amp-ad-4{
551
  margin-top:10px;
552
  }
 
553
  /* Notifications */
554
  #amp-user-notification1 p {
555
  display: inline-block;
577
  padding: 15px 20px 8px 24px;
578
  background: #f3f3f3;
579
  }
 
580
  pre {
581
+ white-space: pre-wrap;
582
  }
583
  /* Responsive */
584
  @media screen and (max-width: 800px) {
586
  padding: 12px 10px 10px 10px
587
  }
588
  }
 
589
  @media screen and (max-width: 630px) {
590
  .related_posts ol li p{
591
  display:none
708
  line-height: 26px;
709
  }
710
  }
 
711
  <?php if($redux_builder_amp['amp-rtl-select-option'] == true) { ?>
712
  /* RTL Start */
713
  .nav_container, .toggle-navigationv2, .amp-loop-list, #pagination, #footer, .amp-wp-meta, .amp-wp-title, .single-post .the_content, .amp-wp-tax-tag, .sticky_social{
780
  text-align:center;
781
  margin: 0 auto
782
  }
 
783
  .amp-wp-author:before{
784
  content: " <?php global $redux_builder_amp; echo $redux_builder_amp['amp-translator-by-text']; ?> ";
785
  }
 
786
  .ampforwp-tax-category span:first-child:after {
787
  content: ' ';
788
  }
 
789
  .ampforwp-tax-category span:after,
790
  .ampforwp-tax-tag span:after {
791
  content: ', ';
794
  .ampforwp-tax-tag span:last-child:after {
795
  content: ' ';
796
  }
797
+ /* New V0.8.7(drag and drop) style */
 
798
  .amp-wp-article-content img {
799
  max-width: 100%;
800
  }
 
 
801
  /* Custom Style Code */
802
  <?php echo $redux_builder_amp['css_editor'];
803
  } ?>
templates/features.php CHANGED
@@ -37,6 +37,9 @@
37
  27. Fixing the defer tag issue [Finally!]
38
  28. Properly removes AMP if turned off from Post panel
39
  29. Remove analytics code if Already added by Glue or Yoast SEO
 
 
 
40
  */
41
  // Adding AMP-related things to the main theme
42
  global $redux_builder_amp;
@@ -75,9 +78,14 @@
75
 
76
  function ampforwp_home_archive_rel_canonical() {
77
  global $redux_builder_amp;
78
- if( is_archive() ) {
79
  return;
80
  }
 
 
 
 
 
81
  if ( is_home() || is_front_page() ){
82
  global $wp;
83
  $current_archive_url = home_url( $wp->request );
@@ -517,6 +525,12 @@ function ampforwp_register_additional_scripts() {
517
  {
518
  $content = preg_replace("/<\\/?" . $tag . "(.|\\s)*?>/",'',$content);
519
  }
 
 
 
 
 
 
520
 
521
  // $content = preg_replace('/<img*/', '<amp-img', $content); // Fallback for plugins
522
  return $content;
@@ -524,7 +538,9 @@ function ampforwp_register_additional_scripts() {
524
 
525
 
526
  // 11.1 Strip unwanted codes and tags from wp_footer for better compatibility with Plugins
527
- add_action( 'pre_amp_render_post','ampforwp_strip_invalid_content_footer');
 
 
528
  function ampforwp_strip_invalid_content_footer() {
529
  add_filter( 'wp_footer', 'ampforwp_the_content_filter_footer', 1 );
530
  }
@@ -629,6 +645,11 @@ function ampforwp_register_additional_scripts() {
629
  );
630
  $metadata['headline'] = $structured_data_archive_title;
631
  }
 
 
 
 
 
632
  return $metadata;
633
  }
634
 
@@ -638,8 +659,11 @@ function ampforwp_register_additional_scripts() {
638
  */
639
  function ampforwp_title_custom_meta() {
640
  add_meta_box( 'ampforwp_title_meta', __( 'Show AMP for Current Page?' ), 'ampforwp_title_callback', 'post','side' );
 
641
 
642
- add_meta_box( 'ampforwp_title_meta', __( 'Show AMP for Current Page?' ), 'ampforwp_title_callback', 'page','side' );
 
 
643
  }
644
  add_action( 'add_meta_boxes', 'ampforwp_title_custom_meta' );
645
 
@@ -648,16 +672,16 @@ add_action( 'add_meta_boxes', 'ampforwp_title_custom_meta' );
648
  */
649
  function ampforwp_title_callback( $post ) {
650
  wp_nonce_field( basename( __FILE__ ), 'ampforwp_title_nonce' );
651
- $ampforwp_stored_meta = get_post_meta( $post->ID );
652
-
653
- // TODO: Move the data storage code, to Save meta Box area as it is not a good idea to update an option everytime, try adding this code inside ampforwp_title_meta_save()
654
  // This code needs a rewrite.
655
  if ( $ampforwp_stored_meta['ampforwp-amp-on-off'][0] == 'hide-amp') {
656
  $exclude_post_value = get_option('ampforwp_exclude_post');
657
  if ( $exclude_post_value == null ) {
658
  $exclude_post_value[] = 0;
659
  }
660
- if ( $exclude_post_value ) {
661
  if ( ! in_array( $post->ID, $exclude_post_value ) ) {
662
  $exclude_post_value[] = $post->ID;
663
  update_option('ampforwp_exclude_post', $exclude_post_value);
@@ -670,11 +694,11 @@ function ampforwp_title_callback( $post ) {
670
  }
671
  if ( $exclude_post_value ) {
672
  if ( in_array( $post->ID, $exclude_post_value ) ) {
673
- $exclude_ids = array_diff($exclude_post_value, array($post->ID) );
674
  update_option('ampforwp_exclude_post', $exclude_ids);
675
  }
676
  }
677
-
678
  }
679
  ?>
680
  <p>
@@ -991,4 +1015,18 @@ function ampforwp_skip_amp_post( $skip, $post_id, $post ) {
991
  if( class_exists( 'Mobile_Detect' )) {
992
  remove_action('option_stylesheet', array('td_mobile_theme', 'mobile'));
993
  }
994
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  27. Fixing the defer tag issue [Finally!]
38
  28. Properly removes AMP if turned off from Post panel
39
  29. Remove analytics code if Already added by Glue or Yoast SEO
40
+ 30. TagDiv menu issue removed
41
+ 31. removing scripts added by cleantalk
42
+ 32. removing bj loading for amp
43
  */
44
  // Adding AMP-related things to the main theme
45
  global $redux_builder_amp;
78
 
79
  function ampforwp_home_archive_rel_canonical() {
80
  global $redux_builder_amp;
81
+ if( is_archive() || is_attachment() ) {
82
  return;
83
  }
84
+ if( is_page() ) {
85
+ if( !$redux_builder_amp['amp-on-off-for-all-pages'] ) {
86
+ return;
87
+ }
88
+ }
89
  if ( is_home() || is_front_page() ){
90
  global $wp;
91
  $current_archive_url = home_url( $wp->request );
525
  {
526
  $content = preg_replace("/<\\/?" . $tag . "(.|\\s)*?>/",'',$content);
527
  }
528
+ // regex on steroids from here on
529
+ // issue #420
530
+ $content = preg_replace("/<div\s(class=.*?)(href=((".'"|'."'".')(.*?)("|'."'".')))\s(width=("|'."'".')(.*?)("|'."'"."))>(.*)<\/div>/i", '<div $1>$11</div>', $content);
531
+ $content = preg_replace('/<like\s(.*?)>(.*)<\/like>/i', '', $content);
532
+ $content = preg_replace('/<g:plusone\s(.*?)>(.*)<\/g:plusone>/i', '', $content);
533
+ $content = preg_replace('/imageanchor="1"/i', '', $content);
534
 
535
  // $content = preg_replace('/<img*/', '<amp-img', $content); // Fallback for plugins
536
  return $content;
538
 
539
 
540
  // 11.1 Strip unwanted codes and tags from wp_footer for better compatibility with Plugins
541
+ if ( ! is_customize_preview() ) {
542
+ add_action( 'pre_amp_render_post','ampforwp_strip_invalid_content_footer');
543
+ }
544
  function ampforwp_strip_invalid_content_footer() {
545
  add_filter( 'wp_footer', 'ampforwp_the_content_filter_footer', 1 );
546
  }
645
  );
646
  $metadata['headline'] = $structured_data_archive_title;
647
  }
648
+
649
+ if ( $metadata['image']['width'] < 696 ) {
650
+ $metadata['image']['width'] = 700 ;
651
+ }
652
+
653
  return $metadata;
654
  }
655
 
659
  */
660
  function ampforwp_title_custom_meta() {
661
  add_meta_box( 'ampforwp_title_meta', __( 'Show AMP for Current Page?' ), 'ampforwp_title_callback', 'post','side' );
662
+ global $redux_builder_amp;
663
 
664
+ if($redux_builder_amp['amp-on-off-for-all-pages']) {
665
+ add_meta_box( 'ampforwp_title_meta', __( 'Show AMP for Current Page?' ), 'ampforwp_title_callback', 'page','side' );
666
+ }
667
  }
668
  add_action( 'add_meta_boxes', 'ampforwp_title_custom_meta' );
669
 
672
  */
673
  function ampforwp_title_callback( $post ) {
674
  wp_nonce_field( basename( __FILE__ ), 'ampforwp_title_nonce' );
675
+ $ampforwp_stored_meta = get_post_meta( $post->ID );
676
+
677
+ // TODO: Move the data storage code, to Save meta Box area as it is not a good idea to update an option everytime, try adding this code inside ampforwp_title_meta_save()
678
  // This code needs a rewrite.
679
  if ( $ampforwp_stored_meta['ampforwp-amp-on-off'][0] == 'hide-amp') {
680
  $exclude_post_value = get_option('ampforwp_exclude_post');
681
  if ( $exclude_post_value == null ) {
682
  $exclude_post_value[] = 0;
683
  }
684
+ if ( $exclude_post_value ) {
685
  if ( ! in_array( $post->ID, $exclude_post_value ) ) {
686
  $exclude_post_value[] = $post->ID;
687
  update_option('ampforwp_exclude_post', $exclude_post_value);
694
  }
695
  if ( $exclude_post_value ) {
696
  if ( in_array( $post->ID, $exclude_post_value ) ) {
697
+ $exclude_ids = array_diff($exclude_post_value, array($post->ID) );
698
  update_option('ampforwp_exclude_post', $exclude_ids);
699
  }
700
  }
701
+
702
  }
703
  ?>
704
  <p>
1015
  if( class_exists( 'Mobile_Detect' )) {
1016
  remove_action('option_stylesheet', array('td_mobile_theme', 'mobile'));
1017
  }
1018
+ }
1019
+
1020
+ //31. removing scripts added by cleantalk
1021
+ add_action('amp_init','ampforwp_remove_js_script_cleantalk');
1022
+ function ampforwp_remove_js_script_cleantalk() {
1023
+ remove_action('wp_loaded', 'ct_add_nocache_script', 1);
1024
+ }
1025
+
1026
+ //32. removing bj loading for amp
1027
+ function ampforwp_remove_bj_load() {
1028
+ if ( function_exists( 'ampforwp_is_amp_endpoint' ) && ampforwp_is_amp_endpoint() ) {
1029
+ add_filter( 'bjll/enabled', '__return_false' );
1030
+ }
1031
+ }
1032
+ add_action( 'bjll/compat', 'ampforwp_remove_bj_load' );