AMP for WP – Accelerated Mobile Pages - Version 0.9.57

Version Description

(5th August 2017) = * See the Full changelog https://ampforwp.com/0-9-57-released-compatibility-issue-fixed-62nd-update/

Download this release

Release Info

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

Code changes from version 0.9.56 to 0.9.57

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.56
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -17,7 +17,8 @@ define('AMPFORWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
17
  define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
18
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
19
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
20
- define('AMPFORWP_VERSION','0.9.56');
 
21
  // any changes to AMP_QUERY_VAR should be refelected here
22
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
23
 
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.57
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
17
  define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
18
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
19
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
20
+ define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
21
+ define('AMPFORWP_VERSION','0.9.57');
22
  // any changes to AMP_QUERY_VAR should be refelected here
23
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
24
 
includes/options/admin-config.php CHANGED
@@ -20,7 +20,7 @@ $extension_listing = '
20
  <div class="extension_desc">
21
  <h2>Advanced AMP ADS</h2>
22
  <p>Add Advertisement directly in the content</p>
23
- <div class="extension_btn">From: $19</div>
24
  </div>
25
  </a></li>
26
  <li class="second"><a href="http://ampforwp.com/contact-form-7/#utm_source=options-panel&utm_medium=extension-tab_cf7&utm_campaign=AMP%20Plugin" target="_blank">
@@ -122,7 +122,7 @@ $gettingstarted_extension_listing = '
122
  <div class="extension_desc">
123
  <h2>Advanced AMP ADS</h2>
124
  <p>Add Advertisement directly in the content</p>
125
- <div class="extension_btn">From: $19</div>
126
  </div>
127
  </a></li>
128
  <li class="second"><a href="http://ampforwp.com/opt-in-forms/#utm_source=options-panel&utm_medium=gettingstarted_opt-in-forms&utm_campaign=AMP%20Plugin" target="_blank">
@@ -744,6 +744,7 @@ Redux::setArgs( "redux_builder_amp", $args );
744
  ),
745
  'default' => '0'
746
  ),
 
747
 
748
  array(
749
  'id' => 'amp-design-2-search-feature',
@@ -766,6 +767,18 @@ Redux::setArgs( "redux_builder_amp", $args );
766
  ),
767
  'default' => '0'
768
  ),
 
 
 
 
 
 
 
 
 
 
 
 
769
  // Call Now button
770
  array(
771
  'id' => 'ampforwp-callnow-button',
@@ -835,6 +848,7 @@ Redux::setArgs( "redux_builder_amp", $args );
835
  'default' => 1,
836
  'subtitle' => __('Enable Social Icons in single', 'accelerated-mobile-pages'),
837
  ),
 
838
  array(
839
  'id' => 'enable-excerpt-single',
840
  'type' => 'switch',
@@ -875,6 +889,14 @@ Redux::setArgs( "redux_builder_amp", $args );
875
  ),
876
  'desc' => __('Display date along with author and category', 'accelerated-mobile-pages' ),
877
  'default' => '0'
 
 
 
 
 
 
 
 
878
  ),
879
  // Related Post
880
  array(
20
  <div class="extension_desc">
21
  <h2>Advanced AMP ADS</h2>
22
  <p>Add Advertisement directly in the content</p>
23
+ <div class="extension_btn">From: $29</div>
24
  </div>
25
  </a></li>
26
  <li class="second"><a href="http://ampforwp.com/contact-form-7/#utm_source=options-panel&utm_medium=extension-tab_cf7&utm_campaign=AMP%20Plugin" target="_blank">
122
  <div class="extension_desc">
123
  <h2>Advanced AMP ADS</h2>
124
  <p>Add Advertisement directly in the content</p>
125
+ <div class="extension_btn">From: $29</div>
126
  </div>
127
  </a></li>
128
  <li class="second"><a href="http://ampforwp.com/opt-in-forms/#utm_source=options-panel&utm_medium=gettingstarted_opt-in-forms&utm_campaign=AMP%20Plugin" target="_blank">
744
  ),
745
  'default' => '0'
746
  ),
747
+
748
 
749
  array(
750
  'id' => 'amp-design-2-search-feature',
767
  ),
768
  'default' => '0'
769
  ),
770
+ // Excerpt Length #1013
771
+ array(
772
+ 'id' =>'amp-design-1-excerpt',
773
+ 'type' =>'text',
774
+ 'subtitle' =>__('Enter the number of words Eg: 10','accelerated-mobile-pages'),
775
+ 'title' =>__('Excerpt Length','accelerated-mobile-pages'),
776
+ 'required' => array(
777
+ array('amp-design-selector', '=' , '1')
778
+ ),
779
+ 'validate' =>'numeric',
780
+ 'default' =>'20',
781
+ ),
782
  // Call Now button
783
  array(
784
  'id' => 'ampforwp-callnow-button',
848
  'default' => 1,
849
  'subtitle' => __('Enable Social Icons in single', 'accelerated-mobile-pages'),
850
  ),
851
+ // Excerpt ON/OFF
852
  array(
853
  'id' => 'enable-excerpt-single',
854
  'type' => 'switch',
889
  ),
890
  'desc' => __('Display date along with author and category', 'accelerated-mobile-pages' ),
891
  'default' => '0'
892
+ ),
893
+ // Pagination //#1015 Pegazee
894
+ array(
895
+ 'id' => 'amp-pagination',
896
+ 'type' => 'switch',
897
+ 'title' => __( 'Pagination in Single', 'accelerated-mobile-pages' ),
898
+ 'default' => 0,
899
+ 'subtitle' => __('Enable the feature to add Pagination in single', 'accelerated-mobile-pages'),
900
  ),
901
  // Related Post
902
  array(
includes/redirect.php CHANGED
@@ -19,6 +19,7 @@ add_action( 'template_redirect', 'ampforwp_check_amp_page_status', 10 );
19
 
20
  function ampforwp_page_template_redirect() {
21
  global $redux_builder_amp;
 
22
 
23
  if($redux_builder_amp['amp-mobile-redirection']){
24
 
19
 
20
  function ampforwp_page_template_redirect() {
21
  global $redux_builder_amp;
22
+ $post_type = '';
23
 
24
  if($redux_builder_amp['amp-mobile-redirection']){
25
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
  Donate link: https://www.paypal.me/Kaludi/5
5
  Requires at least: 3.0
6
- Tested up to: 4.8
7
- Stable tag: 0.9.56
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -137,6 +137,9 @@ You can contact me using this url: http://ampforwp.com/contact/
137
 
138
  == Changelog ==
139
 
 
 
 
140
  = 0.9.56 (31st July 2017) =
141
  * View more details on https://ampforwp.com/page-break-in-amp/
142
  * Page Break / NextPage (Pagination) Support Added #834 #857 (Improvement)
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
  Donate link: https://www.paypal.me/Kaludi/5
5
  Requires at least: 3.0
6
+ Tested up to: 4.8.1
7
+ Stable tag: 0.9.57
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
137
 
138
  == Changelog ==
139
 
140
+ = 0.9.57 (5th August 2017) =
141
+ * See the Full changelog https://ampforwp.com/0-9-57-released-compatibility-issue-fixed-62nd-update/
142
+
143
  = 0.9.56 (31st July 2017) =
144
  * View more details on https://ampforwp.com/page-break-in-amp/
145
  * Page Break / NextPage (Pagination) Support Added #834 #857 (Improvement)
templates/category-widget.php CHANGED
@@ -145,7 +145,7 @@ class AMPFORWP_Categories_Widget extends WP_Widget {
145
  <!-- radio buttons starts Here -->
146
  <label for="<?php echo $this->get_field_id( 'showButton' ); ?>" value="<?php echo esc_attr( $ampforwp_title );?>"><?php echo __('Show View more Button:','accelerated-mobile-pages') ?></label><br>
147
  <label for="<?php echo $this->get_field_id('show_button_1'); ?>">
148
- <input class="widefat" id="<?php echo $this->get_field_id('show_button_1'); ?>" name="<?php echo $this->get_field_name('sho) ?>wButton'); ?>" type="radio" value="yes" <?php if($radio_buttons === 'yes'){ echo 'checked="checked"'; } ?> /><?php echo __('Yes ','accelerated-mobile-pages'); ?>
149
  </label>
150
  <label for="<?php echo $this->get_field_id('show_button_2'); ?>">
151
  <input class="widefat" id="<?php echo $this->get_field_id('show_button_2'); ?>" name="<?php echo $this->get_field_name('showButton'); ?>" type="radio" value="no" <?php if($radio_buttons === 'no'){ echo 'checked="checked"'; } ?> /><?php echo __(' No','accelerated-mobile-pages'); ?>
145
  <!-- radio buttons starts Here -->
146
  <label for="<?php echo $this->get_field_id( 'showButton' ); ?>" value="<?php echo esc_attr( $ampforwp_title );?>"><?php echo __('Show View more Button:','accelerated-mobile-pages') ?></label><br>
147
  <label for="<?php echo $this->get_field_id('show_button_1'); ?>">
148
+ <input class="widefat" id="<?php echo $this->get_field_id('show_button_1'); ?>" name="<?php echo $this->get_field_name('showButton'); ?>" type="radio" value="yes" <?php if($radio_buttons === 'yes'){ echo 'checked="checked"'; } ?> /><?php echo __('Yes ','accelerated-mobile-pages'); ?>
149
  </label>
150
  <label for="<?php echo $this->get_field_id('show_button_2'); ?>">
151
  <input class="widefat" id="<?php echo $this->get_field_id('show_button_2'); ?>" name="<?php echo $this->get_field_name('showButton'); ?>" type="radio" value="no" <?php if($radio_buttons === 'no'){ echo 'checked="checked"'; } ?> /><?php echo __(' No','accelerated-mobile-pages'); ?>
templates/customizer/customizer-new.php ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMPFORWP_Customizer_Design_Contols extends AMP_Customizer_Design_Settings {
3
+ const NEW_COLOR_SCHEME = 'light';
4
+
5
+ public static function init() {
6
+ add_action( 'amp_customizer_init', array( __CLASS__, 'init_customizer' ) );
7
+ add_filter( 'amp_customizer_get_settings', array( __CLASS__, 'append_settings' ) );
8
+ }
9
+
10
+ public static function init_customizer() {
11
+ add_action( 'amp_customizer_register_settings', array( __CLASS__, 'register_customizer_settings' ) );
12
+ add_action( 'amp_customizer_register_ui', array( __CLASS__, 'register_customizer_ui' ) );
13
+ add_action( 'amp_customizer_enqueue_preview_scripts', array( __CLASS__, 'enqueue_customizer_preview_scripts' ) );
14
+ }
15
+
16
+ public static function register_customizer_settings( $wp_customize ) {
17
+
18
+ /* Add Settings */
19
+ $wp_customize->add_setting(
20
+ 'ampforwp_design[elements]', /* option name */
21
+ array(
22
+ 'default' => self::ampforwp_controls_default(),
23
+ // 'sanitize_callback' => 'ampforwp_sanitize_controller',
24
+ 'transport' => 'postMessage',
25
+ 'type' => 'option',
26
+ 'capability' => 'manage_options',
27
+ 'priority' => 10,
28
+ )
29
+ );
30
+
31
+ // $wp_customize->add_setting(
32
+ // 'ampforwp_design[amp_design_type]', /* option name */
33
+ // array(
34
+ // 'default' => '3',
35
+ // 'transport' => 'postMessage',
36
+ // 'type' => 'option',
37
+ // 'capability' => 'manage_options',
38
+ // 'priority' => 10,
39
+ // )
40
+ // );
41
+
42
+ }
43
+
44
+ public static function register_customizer_ui( $wp_customize ) {
45
+ /* Load custom controls */
46
+ require_once( AMPFORWP_PLUGIN_DIR . 'templates/customizer/customizer-controls.php' );
47
+
48
+ /* Add Control for the settings. */
49
+ $choices = array();
50
+ $services = self::ampforwp_controls();
51
+ foreach( $services as $key => $val ){
52
+ $choices[$key] = $val['label'];
53
+ }
54
+ $wp_customize->add_control(
55
+ new AMPFORWP_Customize_Control_Sortable_Checkboxes(
56
+ $wp_customize, 'ampforwp_controls',
57
+ array(
58
+ 'section' => 'amp_design',
59
+ 'settings' => 'ampforwp_design[elements]',
60
+ 'label' => __( 'Design Manager', 'accelerated-mobile-pages' ),
61
+ 'description' => __( 'Enable and reorder Design Elements.', 'accelerated-mobile-pages' ),
62
+ 'choices' => $choices,
63
+ 'priority' => 9,
64
+ )
65
+ )
66
+ );
67
+
68
+ // Current AMP Design
69
+ // $wp_customize->add_control( 'ampforwp_design[amp_design_type]', array(
70
+ // 'settings' => 'ampforwp_design[amp_design_type]',
71
+ // 'label' => __( 'Current AMP Design', 'ampforwp' ),
72
+ // 'section' => 'amp_design',
73
+ // 'type' => 'select',
74
+ // 'priority' => 30,
75
+ // 'choices' => array(
76
+ // '1' => 'one',
77
+ // '2' => 'two',
78
+ // '3' => 'three' ),
79
+ // ));
80
+ }
81
+
82
+ public static function enqueue_customizer_preview_scripts() {
83
+
84
+ wp_register_script( 'ampforwp-customizer-design-preview', plugin_dir_url( __FILE__ ) . 'assets/customizer-preview.js', array( 'amp-customizer' ), false, true );
85
+ global $redux_builder_amp;
86
+ $ampforwp_customizer_settings = array( 'design_type' => $redux_builder_amp['amp-design-selector'] );
87
+
88
+ wp_localize_script( 'ampforwp-customizer-design-preview', 'ampforwp_customizer_settings', $ampforwp_customizer_settings );
89
+
90
+ wp_enqueue_script( 'ampforwp-customizer-design-preview' );
91
+ }
92
+
93
+ public static function append_settings( $settings ) {
94
+ $settings = wp_parse_args( $settings, array(
95
+ 'color_scheme_new' => self::NEW_COLOR_SCHEME,
96
+ ) );
97
+
98
+ $theme_colors = self::get_colors_for_color_scheme( $settings['color_scheme'] );
99
+
100
+ return array_merge( $settings, $theme_colors, array(
101
+ 'link_color' => $settings['header_background_color'],
102
+ // 'amp_design_type' => $settings['ampforwp_design[amp_design_type]'],
103
+ ) );
104
+ }
105
+
106
+ /**
107
+ * Sanitize Sharing Services
108
+ * @since 0.1.0
109
+ */
110
+ private function ampforwp_sanitize_controller( $input ){
111
+
112
+ /* Var */
113
+ $output = array();
114
+
115
+ /* Get valid services */
116
+ $valid_services = self::ampforwp_controls();
117
+ // var_dump($valid_services);
118
+
119
+ /* Make array */
120
+ $services = explode( ',', $input );
121
+
122
+ /* Bail. */
123
+ if( ! $services ){
124
+ return null;
125
+ }
126
+
127
+ /* Loop and verify */
128
+ foreach( $services as $service ){
129
+
130
+ /* Separate service and status */
131
+ $service = explode( ':', $service );
132
+
133
+ if( isset( $service[0] ) && isset( $service[1] ) ){
134
+ if( array_key_exists( $service[0], $valid_services ) ){
135
+ $status = $service[1] ? '1' : '0';
136
+ $output[] = trim( $service[0] . ':' . $status );
137
+ }
138
+ }
139
+
140
+ }
141
+
142
+ return trim( esc_attr( implode( ',', $output ) ) );
143
+ }
144
+
145
+ /**
146
+ * Services
147
+ * list of available sharing services
148
+ */
149
+ static public function ampforwp_controls(){
150
+
151
+ $services = array();
152
+
153
+ /* Meta info */
154
+ $services['meta_info'] = array(
155
+ 'id' => 'meta_info',
156
+ 'label' => __( 'Meta info', 'accelerated-mobile-pages' ),
157
+ );
158
+
159
+ /* title */
160
+ $services['title'] = array(
161
+ 'id' => 'title',
162
+ 'label' => __( 'Title', 'accelerated-mobile-pages' ),
163
+ );
164
+
165
+ /* Featured Image */
166
+ $services['featured_image'] = array(
167
+ 'id' => 'featured_image',
168
+ 'label' => __( 'Featured Image', 'accelerated-mobile-pages' ),
169
+ );
170
+
171
+ /* The Content */
172
+ $services['content'] = array(
173
+ 'id' => 'content',
174
+ 'label' => __( 'The Content', 'accelerated-mobile-pages' ),
175
+ );
176
+
177
+ /* Meta Taxonomy */
178
+ $services['meta_taxonomy'] = array(
179
+ 'id' => 'meta_taxonomy',
180
+ 'label' => __( 'Categories and Tags', 'accelerated-mobile-pages'),
181
+ );
182
+
183
+ /* Social Icons */
184
+ $services['social_icons'] = array(
185
+ 'id' => 'social_icons',
186
+ 'label' => __( 'Social Icons', 'accelerated-mobile-pages' ),
187
+ );
188
+
189
+ /* Comments */
190
+ $services['comments'] = array(
191
+ 'id' => 'comments',
192
+ 'label' => __( 'Comments', 'accelerated-mobile-pages' ),
193
+ );
194
+
195
+ /* Related Posts */
196
+ $services['related_posts'] = array(
197
+ 'id' => 'related_posts',
198
+ 'label' => __( 'Related Posts', 'accelerated-mobile-pages' ),
199
+ );
200
+
201
+ return apply_filters( 'ampforwp_controls', $services );
202
+ }
203
+
204
+
205
+ /**
206
+ * Utility: Default Services to use in customizer default value
207
+ * @return string
208
+ */
209
+ static public function ampforwp_controls_default(){
210
+ $default = array();
211
+ $services = self::ampforwp_controls();
212
+ foreach( $services as $service ){
213
+ $default[] = $service['id'] . ':1'; /* activate all as default. */
214
+ }
215
+ return apply_filters( 'ampforwp_controls_default', implode( ',', $default ) );
216
+ }
217
+ }
218
+
219
+ // Add New Contols and Settings in Customizer
220
+ // add_action( 'amp_init', array( 'AMPFORWP_Customizer_Design_Contols', 'init' ) );
221
+ add_action( 'amp_init', function(){
222
+ AMPFORWP_Customizer_Design_Contols::init();
223
+ } );
224
+
225
+ /* Register Customizer Scripts */
226
+ add_action( 'customize_controls_enqueue_scripts', 'ampforwp_customize_register_scripts', 0 );
227
+ define( 'AMPFORWP_SHARE_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
228
+
229
+ /**
230
+ * Register Scripts
231
+ * so we can easily load this scripts multiple times when needed (?)
232
+ */
233
+ function ampforwp_customize_register_scripts(){
234
+
235
+ /* CSS */
236
+ wp_register_style( 'ampforwp-share-customize', AMPFORWP_SHARE_URL . 'assets/customizer-control.css' );
237
+
238
+ /* JS */
239
+ wp_register_script( 'ampforwp-share-customize', AMPFORWP_SHARE_URL . 'assets/customizer-control.js', array( 'jquery', 'jquery-ui-sortable', 'customize-controls' ) );
240
+
241
+ global $redux_builder_amp;
242
+ $ampforwp_customizer_settings = array( 'design_type' => $redux_builder_amp['amp-design-selector'] );
243
+
244
+ wp_localize_script( 'ampforwp-share-customize', 'ampforwp_customizer_settings', $ampforwp_customizer_settings );
245
+ }
templates/design-manager/design-1/archive.php CHANGED
@@ -90,6 +90,7 @@
90
  <a href="<?php echo esc_url( $ampforwp_amp_post_url ); ?>">
91
  <amp-img
92
  src=<?php echo $thumb_url ?>
 
93
  <?php if( $redux_builder_amp['ampforwp-homepage-posts-image-modify-size'] ) { ?>
94
  width=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-width'] ?>
95
  height=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-height'] ?>
@@ -106,7 +107,9 @@
106
  }else{
107
  $content = get_the_content();
108
  } ?>
109
- <p><?php echo wp_trim_words( strip_shortcodes( $content ) , '20'); ?></p>
 
 
110
  </div>
111
  </div>
112
  <?php endwhile; ?>
90
  <a href="<?php echo esc_url( $ampforwp_amp_post_url ); ?>">
91
  <amp-img
92
  src=<?php echo $thumb_url ?>
93
+ <?php ampforwp_thumbnail_alt(); ?>
94
  <?php if( $redux_builder_amp['ampforwp-homepage-posts-image-modify-size'] ) { ?>
95
  width=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-width'] ?>
96
  height=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-height'] ?>
107
  }else{
108
  $content = get_the_content();
109
  } ?>
110
+ <p><?php global $redux_builder_amp;
111
+ $excertp_length = $redux_builder_amp['amp-design-1-excerpt'];
112
+ echo wp_trim_words( strip_shortcodes( $content ) , $excertp_length ); ?></p>
113
  </div>
114
  </div>
115
  <?php endwhile; ?>
templates/design-manager/design-1/elements/content.php CHANGED
@@ -23,6 +23,8 @@ if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
23
  // Custom/Alternative AMP content added through post meta
24
  $ampforwp_the_content = $this->get( 'ampforwp_amp_content' );
25
  }
 
 
26
  $ampforwp_new_content = explode('<!--nextpage-->', $ampforwp_the_content);
27
  $queried_var = get_query_var('page');
28
  if ( $queried_var > 1 ) {
@@ -32,8 +34,12 @@ if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
32
  $queried_var = 0;
33
  }
34
  echo $ampforwp_new_content[$queried_var];
35
- do_action('ampforwp_after_post_content',$this) ?>
36
-
 
 
 
 
37
  <!--Post Next-Previous Links-->
38
  <?php
39
  if($redux_builder_amp['enable-single-next-prev']) { ?>
23
  // Custom/Alternative AMP content added through post meta
24
  $ampforwp_the_content = $this->get( 'ampforwp_amp_content' );
25
  }
26
+
27
+ if($redux_builder_amp['amp-pagination']) {
28
  $ampforwp_new_content = explode('<!--nextpage-->', $ampforwp_the_content);
29
  $queried_var = get_query_var('page');
30
  if ( $queried_var > 1 ) {
34
  $queried_var = 0;
35
  }
36
  echo $ampforwp_new_content[$queried_var];
37
+ do_action('ampforwp_after_post_content',$this) ;
38
+ }
39
+ else{
40
+ echo $ampforwp_the_content;
41
+ }//#1015 Pegazee
42
+ ?>
43
  <!--Post Next-Previous Links-->
44
  <?php
45
  if($redux_builder_amp['enable-single-next-prev']) { ?>
templates/design-manager/design-1/frontpage.php CHANGED
@@ -23,7 +23,7 @@ $template = new AMP_Post_Template( $post_id );?>
23
  <?php do_action( 'amp_post_template_css', $template ); ?>
24
  </style>
25
  </head>
26
- <body class="single-post amp-wp-frontpage design_1_wrapper">
27
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
28
 
29
  <?php do_action('ampforwp_frontpage_above_loop',$template, $post_id) ?>
23
  <?php do_action( 'amp_post_template_css', $template ); ?>
24
  </style>
25
  </head>
26
+ <body class="single-post <?php ampforwp_the_body_class(); ?> amp-wp-frontpage design_1_wrapper">
27
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
28
 
29
  <?php do_action('ampforwp_frontpage_above_loop',$template, $post_id) ?>
templates/design-manager/design-1/header-bar.php CHANGED
@@ -24,11 +24,11 @@
24
  <?php if (true == ($redux_builder_amp['opt-media']['url'])) { ?>
25
  <?php if($redux_builder_amp['ampforwp-custom-logo-dimensions'] == true) { ?>
26
 
27
- <amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="<?php echo $redux_builder_amp['opt-media-width']; ?>" height="<?php echo $redux_builder_amp['opt-media-height']; ?>" alt="logo" class="amp-logo"></amp-img>
28
 
29
  <?php } else { ?>
30
 
31
- <amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="190" height="36" alt="logo" class="amp-logo"></amp-img>
32
 
33
  <?php } ?>
34
  <?php } else {
24
  <?php if (true == ($redux_builder_amp['opt-media']['url'])) { ?>
25
  <?php if($redux_builder_amp['ampforwp-custom-logo-dimensions'] == true) { ?>
26
 
27
+ <amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="<?php echo $redux_builder_amp['opt-media-width']; ?>" height="<?php echo $redux_builder_amp['opt-media-height']; ?>" alt="<?php bloginfo('name'); ?>" class="amp-logo"></amp-img>
28
 
29
  <?php } else { ?>
30
 
31
+ <amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="190" height="36" alt="<?php bloginfo('name'); ?>" class="amp-logo"></amp-img>
32
 
33
  <?php } ?>
34
  <?php } else {
templates/design-manager/design-1/index.php CHANGED
@@ -73,6 +73,7 @@
73
  <a href="<?php echo trailingslashit( trailingslashit( $ampforwp_post_url ) . AMPFORWP_AMP_QUERY_VAR );?>">
74
  <amp-img
75
  src=<?php echo $thumb_url ?>
 
76
  <?php if( $redux_builder_amp['ampforwp-homepage-posts-image-modify-size'] ) { ?>
77
  width=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-width'] ?>
78
  height=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-height'] ?>
@@ -84,12 +85,15 @@
84
  </a>
85
  </div>
86
  <?php }
 
87
  if(has_excerpt()){
88
  $content = get_the_excerpt();
89
  }else{
90
  $content = get_the_content();
91
  } ?>
92
- <p><?php echo wp_trim_words( strip_shortcodes( $content ) , '20' ); ?></p>
 
 
93
  </div>
94
  </div>
95
  <?php endwhile; ?>
73
  <a href="<?php echo trailingslashit( trailingslashit( $ampforwp_post_url ) . AMPFORWP_AMP_QUERY_VAR );?>">
74
  <amp-img
75
  src=<?php echo $thumb_url ?>
76
+ <?php ampforwp_thumbnail_alt(); ?>
77
  <?php if( $redux_builder_amp['ampforwp-homepage-posts-image-modify-size'] ) { ?>
78
  width=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-width'] ?>
79
  height=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-height'] ?>
85
  </a>
86
  </div>
87
  <?php }
88
+
89
  if(has_excerpt()){
90
  $content = get_the_excerpt();
91
  }else{
92
  $content = get_the_content();
93
  } ?>
94
+ <p><?php global $redux_builder_amp;
95
+ $excertp_length = $redux_builder_amp['amp-design-1-excerpt'];
96
+ echo wp_trim_words( strip_shortcodes( $content ) , $excertp_length ); ?></p>
97
  </div>
98
  </div>
99
  <?php endwhile; ?>
templates/design-manager/design-1/search.php CHANGED
@@ -90,7 +90,9 @@
90
  }else{
91
  $content = get_the_content();
92
  } ?>
93
- <p><?php echo wp_trim_words( strip_shortcodes( $content ) , '20'); ?></p>
 
 
94
  </div>
95
  </div>
96
  <?php endwhile; ?>
90
  }else{
91
  $content = get_the_content();
92
  } ?>
93
+ <p><?php global $redux_builder_amp;
94
+ $excertp_length = $redux_builder_amp['amp-design-1-excerpt'];
95
+ echo wp_trim_words( strip_shortcodes( $content ) , $excertp_length ); ?></p>
96
  </div>
97
  </div>
98
  <?php endwhile; ?>
templates/design-manager/design-1/single.php CHANGED
@@ -10,7 +10,7 @@
10
  </style>
11
  </head>
12
 
13
- <body class="<?php echo esc_attr( $this->get( 'body_class' ) ); ?> single-post <?php if(is_page()){ echo'amp-single-page'; };?> design_1_wrapper">
14
 
15
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
16
 
10
  </style>
11
  </head>
12
 
13
+ <body class="<?php echo esc_attr( $this->get( 'body_class' ) ); ?> single-post <?php ampforwp_the_body_class(); ?> <?php if(is_page()){ echo'amp-single-page'; };?> design_1_wrapper">
14
 
15
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
16
 
templates/design-manager/design-2/archive.php CHANGED
@@ -79,6 +79,7 @@
79
  <a href="<?php echo esc_url( $ampforwp_amp_post_url ); ?>">
80
  <amp-img
81
  src=<?php echo $thumb_url ?>
 
82
  <?php if( $redux_builder_amp['ampforwp-homepage-posts-image-modify-size'] ) { ?>
83
  width=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-width'] ?>
84
  height=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-height'] ?>
79
  <a href="<?php echo esc_url( $ampforwp_amp_post_url ); ?>">
80
  <amp-img
81
  src=<?php echo $thumb_url ?>
82
+ <?php ampforwp_thumbnail_alt(); ?>
83
  <?php if( $redux_builder_amp['ampforwp-homepage-posts-image-modify-size'] ) { ?>
84
  width=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-width'] ?>
85
  height=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-height'] ?>
templates/design-manager/design-2/elements/content.php CHANGED
@@ -25,6 +25,8 @@ if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
25
  $ampforwp_the_content = $this->get( 'ampforwp_amp_content' );
26
  }
27
  // echo $this->get( 'post_amp_content' ); // amphtml content; no kses
 
 
28
  $ampforwp_new_content = explode('<!--nextpage-->', $ampforwp_the_content);
29
  $queried_var = get_query_var('page');
30
  if ( $queried_var > 1 ) {
@@ -34,7 +36,12 @@ if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
34
  $queried_var = 0;
35
  }
36
  echo $ampforwp_new_content[$queried_var];
37
- do_action('ampforwp_after_post_content',$this) ; //Post After Content here ?>
 
 
 
 
 
38
 
39
  </div>
40
  <!--Post Content Ends here-->
25
  $ampforwp_the_content = $this->get( 'ampforwp_amp_content' );
26
  }
27
  // echo $this->get( 'post_amp_content' ); // amphtml content; no kses
28
+
29
+ if($redux_builder_amp['amp-pagination']) {
30
  $ampforwp_new_content = explode('<!--nextpage-->', $ampforwp_the_content);
31
  $queried_var = get_query_var('page');
32
  if ( $queried_var > 1 ) {
36
  $queried_var = 0;
37
  }
38
  echo $ampforwp_new_content[$queried_var];
39
+ do_action('ampforwp_after_post_content',$this) ; //Post After Content here
40
+ }
41
+ else{
42
+ echo $ampforwp_the_content;
43
+ }//#1015 Pegazee
44
+ ?>
45
 
46
  </div>
47
  <!--Post Content Ends here-->
templates/design-manager/design-2/frontpage.php CHANGED
@@ -22,7 +22,7 @@ $template = new AMP_Post_Template( $post_id );?>
22
  <?php do_action( 'amp_post_template_css', $this ); ?>
23
  </style>
24
  </head>
25
- <body class="single-post design_2_wrapper">
26
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
27
 
28
  <?php do_action( 'ampforwp_design_2_frontpage_title', $template ); ?>
22
  <?php do_action( 'amp_post_template_css', $this ); ?>
23
  </style>
24
  </head>
25
+ <body class="single-post <?php ampforwp_the_body_class(); ?> design_2_wrapper">
26
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
27
 
28
  <?php do_action( 'ampforwp_design_2_frontpage_title', $template ); ?>
templates/design-manager/design-2/header-bar.php CHANGED
@@ -32,11 +32,11 @@
32
 
33
  <?php if($redux_builder_amp['ampforwp-custom-logo-dimensions'] == true) { ?>
34
 
35
- <amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="<?php echo $redux_builder_amp['opt-media-width']; ?>" height="<?php echo $redux_builder_amp['opt-media-height']; ?>" alt="logo" class="amp-logo"></amp-img>
36
 
37
  <?php } else { ?>
38
 
39
- <amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="190" height="36" alt="logo" class="amp-logo"></amp-img>
40
 
41
  <?php } ?>
42
 
32
 
33
  <?php if($redux_builder_amp['ampforwp-custom-logo-dimensions'] == true) { ?>
34
 
35
+ <amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="<?php echo $redux_builder_amp['opt-media-width']; ?>" height="<?php echo $redux_builder_amp['opt-media-height']; ?>" alt= "<?php bloginfo('name'); ?>" class="amp-logo"></amp-img>
36
 
37
  <?php } else { ?>
38
 
39
+ <amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="190" height="36" alt= "<?php bloginfo('name'); ?>" class="amp-logo"></amp-img>
40
 
41
  <?php } ?>
42
 
templates/design-manager/design-2/index.php CHANGED
@@ -57,6 +57,7 @@
57
  <div class="home-post_image">
58
  <a href="<?php echo esc_url( $ampforwp_amp_post_url ); ?>">
59
  <amp-img src=<?php echo $thumb_url ?>
 
60
  <?php if( $redux_builder_amp['ampforwp-homepage-posts-image-modify-size'] ) { ?>
61
  width=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-width'] ?>
62
  height=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-height'] ?>
@@ -83,6 +84,21 @@
83
  <p><?php echo wp_trim_words( strip_shortcodes( $content ) , '15' ); ?></p>
84
 
85
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  <div class="cb"></div>
87
  </div>
88
 
57
  <div class="home-post_image">
58
  <a href="<?php echo esc_url( $ampforwp_amp_post_url ); ?>">
59
  <amp-img src=<?php echo $thumb_url ?>
60
+ <?php ampforwp_thumbnail_alt(); ?>
61
  <?php if( $redux_builder_amp['ampforwp-homepage-posts-image-modify-size'] ) { ?>
62
  width=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-width'] ?>
63
  height=<?php global $redux_builder_amp; echo $redux_builder_amp['ampforwp-homepage-posts-design-1-2-height'] ?>
84
  <p><?php echo wp_trim_words( strip_shortcodes( $content ) , '15' ); ?></p>
85
 
86
  </div>
87
+ <div class="amp-wp-meta">
88
+ <?php $this->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-author') ) ); ?>
89
+ <time> <?php
90
+ $post_date = human_time_diff( get_the_time('U', get_the_ID() ), current_time('timestamp') ) .' '. ampforwp_translation( $redux_builder_amp['amp-translator-ago-date-text'],'ago' );
91
+ $post_date = apply_filters('ampforwp_modify_post_date',$post_date);
92
+ echo $post_date ; ?>
93
+ </time>
94
+ <?php $post_author = $this->get( 'post_author' ); ?>
95
+ <div class="amp-wp-author-name">
96
+ <?php
97
+ $author_name =get_the_author();
98
+ echo esc_html( $author_name); ?>
99
+ </div>
100
+ </div>
101
+
102
  <div class="cb"></div>
103
  </div>
104
 
templates/design-manager/design-2/single.php CHANGED
@@ -10,7 +10,7 @@
10
  <?php do_action( 'amp_post_template_css', $this ); ?>
11
  </style>
12
  </head>
13
- <body class="single-post <?php if(is_page()){ echo'amp-single-page'; };?> design_2_wrapper">
14
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
15
 
16
  <?php do_action( 'ampforwp_after_header', $this ); ?>
10
  <?php do_action( 'amp_post_template_css', $this ); ?>
11
  </style>
12
  </head>
13
+ <body class="single-post <?php ampforwp_the_body_class(); ?> <?php if(is_page()){ echo'amp-single-page'; };?> design_2_wrapper">
14
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
15
 
16
  <?php do_action( 'ampforwp_after_header', $this ); ?>
templates/design-manager/design-2/style.php CHANGED
@@ -140,6 +140,7 @@ figcaption{ font-size: 11px; margin-bottom: 11px; background: #eee; padding: 6px
140
  .amp-wp-author:before{ content: "By "; color: #555; }
141
  .amp-wp-author{ margin-right: 1px; }
142
  .amp-wp-meta{ font-size: 12px; color: #555; }
 
143
  .amp-ad-wrapper{ text-align: center }
144
  .single-post main{ padding:12px 15% 10px 15% }
145
  .the_content p{ margin-top: 5px; color: #333; font-size: 15px; line-height: 26px; margin-bottom: 15px; }
140
  .amp-wp-author:before{ content: "By "; color: #555; }
141
  .amp-wp-author{ margin-right: 1px; }
142
  .amp-wp-meta{ font-size: 12px; color: #555; }
143
+ .amp-wp-author-name:before{content:'By';}
144
  .amp-ad-wrapper{ text-align: center }
145
  .single-post main{ padding:12px 15% 10px 15% }
146
  .the_content p{ margin-top: 5px; color: #333; font-size: 15px; line-height: 26px; margin-bottom: 15px; }
templates/design-manager/design-3/archive.php CHANGED
@@ -97,6 +97,7 @@ if ( get_query_var( 'paged' ) ) {
97
  <amp-img
98
  layout="responsive"
99
  src=<?php echo $thumb_url ?>
 
100
  width=450
101
  height=270
102
  ></amp-img>
97
  <amp-img
98
  layout="responsive"
99
  src=<?php echo $thumb_url ?>
100
+ <?php ampforwp_thumbnail_alt(); ?>
101
  width=450
102
  height=270
103
  ></amp-img>
templates/design-manager/design-3/elements/content.php CHANGED
@@ -27,6 +27,7 @@ if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
27
  }
28
 
29
  // echo $this->get( 'post_amp_content' ); // amphtml content; no kses
 
30
  $ampforwp_new_content = explode('<!--nextpage-->', $ampforwp_the_content);
31
  $queried_var = get_query_var('page');
32
  if ( $queried_var > 1 ) {
@@ -36,8 +37,12 @@ if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
36
  $queried_var = 0;
37
  }
38
  echo $ampforwp_new_content[$queried_var];
39
- do_action('ampforwp_after_post_content',$this) ; //Post After Content here ?>
40
-
 
 
 
 
41
  </div>
42
  <!--Post Content Ends here-->
43
 
27
  }
28
 
29
  // echo $this->get( 'post_amp_content' ); // amphtml content; no kses
30
+ if($redux_builder_amp['amp-pagination']) {
31
  $ampforwp_new_content = explode('<!--nextpage-->', $ampforwp_the_content);
32
  $queried_var = get_query_var('page');
33
  if ( $queried_var > 1 ) {
37
  $queried_var = 0;
38
  }
39
  echo $ampforwp_new_content[$queried_var];
40
+ do_action('ampforwp_after_post_content',$this) ; //Post After Content here
41
+ }
42
+ else{
43
+ echo $ampforwp_the_content;
44
+ }//#1015 pegazee
45
+ ?>
46
  </div>
47
  <!--Post Content Ends here-->
48
 
templates/design-manager/design-3/frontpage.php CHANGED
@@ -23,7 +23,7 @@ $template = new AMP_Post_Template( $post_id );?>
23
  <?php do_action( 'amp_post_template_css', $this ); ?>
24
  </style>
25
  </head>
26
- <body class="single-post design_3_wrapper">
27
 
28
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
29
 
23
  <?php do_action( 'amp_post_template_css', $this ); ?>
24
  </style>
25
  </head>
26
+ <body class="single-post <?php ampforwp_the_body_class(); ?> design_3_wrapper">
27
 
28
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
29
 
templates/design-manager/design-3/header-bar.php CHANGED
@@ -115,11 +115,11 @@
115
 
116
  <?php if($redux_builder_amp['ampforwp-custom-logo-dimensions'] == true) { ?>
117
 
118
- <amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="<?php echo $redux_builder_amp['opt-media-width']; ?>" height="<?php echo $redux_builder_amp['opt-media-height']; ?>" alt="logo" class="amp-logo"></amp-img>
119
 
120
  <?php } else { ?>
121
 
122
- <amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="190" height="36" alt="logo" class="amp-logo"></amp-img>
123
 
124
  <?php } ?>
125
 
115
 
116
  <?php if($redux_builder_amp['ampforwp-custom-logo-dimensions'] == true) { ?>
117
 
118
+ <amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="<?php echo $redux_builder_amp['opt-media-width']; ?>" height="<?php echo $redux_builder_amp['opt-media-height']; ?>" alt="<?php bloginfo('name'); ?>" class="amp-logo"></amp-img>
119
 
120
  <?php } else { ?>
121
 
122
+ <amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="190" height="36" alt="<?php bloginfo('name'); ?>" class="amp-logo"></amp-img>
123
 
124
  <?php } ?>
125
 
templates/design-manager/design-3/index.php CHANGED
@@ -119,6 +119,7 @@ if ( get_query_var( 'paged' ) ) {
119
  <amp-img
120
  layout="responsive"
121
  src=<?php echo $thumb_url ?>
 
122
  width=450
123
  height=270
124
  ></amp-img>
119
  <amp-img
120
  layout="responsive"
121
  src=<?php echo $thumb_url ?>
122
+ <?php ampforwp_thumbnail_alt(); ?>
123
  width=450
124
  height=270
125
  ></amp-img>
templates/design-manager/design-3/single.php CHANGED
@@ -10,7 +10,7 @@
10
  <?php do_action( 'amp_post_template_css', $this ); ?>
11
  </style>
12
  </head>
13
- <body class="design_3_wrapper single-post <?php if(is_page()){ echo'amp-single-page'; };?>">
14
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
15
 
16
  <?php do_action( 'ampforwp_after_header', $this ); ?>
10
  <?php do_action( 'amp_post_template_css', $this ); ?>
11
  </style>
12
  </head>
13
+ <body class="design_3_wrapper single-post <?php ampforwp_the_body_class(); ?> <?php if(is_page()){ echo'amp-single-page'; };?>">
14
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
15
 
16
  <?php do_action( 'ampforwp_after_header', $this ); ?>
templates/features.php CHANGED
@@ -85,7 +85,6 @@
85
 
86
  // 0.9. AMP Design Manager Files
87
  require 'design-manager.php';
88
- require 'customizer/customizer.php';
89
  // Custom AMP Content
90
  require 'custom-amp-content.php';
91
  // Custom AMPFORWP Sanitizers
@@ -93,6 +92,18 @@
93
  // Custom Frontpage items
94
  require 'frontpage-elements.php';
95
  require AMPFORWP_PLUGIN_DIR . '/classes/class-ampforwp-youtube-embed.php' ;
 
 
 
 
 
 
 
 
 
 
 
 
96
  //0.
97
 
98
  define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
@@ -389,11 +400,15 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
389
  // moved this code to its own function and done the AMP way
390
  }
391
  // 6.1 Adding Analytics Scripts
392
- add_action('amp_post_template_head','ampforwp_register_analytics_script', 20);
393
- function ampforwp_register_analytics_script(){ ?>
394
- <script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
395
- <?php
396
-
 
 
 
 
397
  }
398
 
399
  add_filter( 'amp_post_template_data', 'ampforwp_add_amp_related_scripts', 20 );
@@ -716,7 +731,7 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
716
  // 10.2 Analytics Support added for segment.com
717
  if ( $redux_builder_amp['amp-analytics-select-option']=='2' ) { ?>
718
  <amp-analytics type="segment">
719
- <script>
720
  {
721
  "vars": {
722
  "writeKey": "<?php global $redux_builder_amp; echo $redux_builder_amp['sa-feild']; ?>",
@@ -763,22 +778,6 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
763
  <?php
764
  }
765
 
766
- // 10.5 Analytics Support added for comscore
767
- if ( $redux_builder_amp['amp-analytics-select-option']=='5' ) { ?>
768
- <amp-analytics type="comscore">
769
- <script type="application/json">
770
- {
771
- "vars": {
772
- "c1": "<?php echo $redux_builder_amp['amp-comscore-analytics-code-c1']; ?>",
773
- "c2": "<?php echo $redux_builder_amp['amp-comscore-analytics-code-c2']; ?>"
774
- }
775
- }
776
- </script>
777
- </amp-analytics>
778
- <?php
779
- }
780
-
781
-
782
  // 10.6 Analytics Support added for Effective Measure
783
  if( $redux_builder_amp['amp-analytics-select-option']=='6' ) { ?>
784
  <!-- BEGIN EFFECTIVE MEASURE CODE -->
@@ -1431,6 +1430,8 @@ function ampforwp_remove_schema_data() {
1431
  }
1432
  //Removing the WPTouch Pro social share links from AMP
1433
  remove_filter( 'the_content', 'foundation_handle_share_links_bottom', 100 );
 
 
1434
  }
1435
 
1436
  // 22. Removing author links from comments Issue #180
@@ -2844,70 +2845,27 @@ function ampforwp_frontpage_comments() {
2844
 
2845
 
2846
  // 64. PageBuilder
2847
- add_action('pre_amp_render_post','ampforwp_apply_layout_builder_on_pages' );
2848
  function ampforwp_apply_layout_builder_on_pages($post_id) {
2849
  global $redux_builder_amp;
2850
 
2851
  if ( is_home() ) {
2852
  $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
2853
  }
2854
-
2855
  $sidebar_check = get_post_meta( $post_id,'ampforwp_custom_sidebar_select',true);
2856
 
2857
  if ( $redux_builder_amp['ampforwp-content-builder'] && $sidebar_check === 'layout-builder') {
2858
- // Add Layout Builder Elements
2859
- add_action('ampforwp_post_before_design_elements','ampforwp_add_landing_page_elements');
2860
- add_action('ampforwp_frontpage_above_loop','ampforwp_add_landing_page_elements');
2861
- // Add Styling
2862
- add_action('amp_post_template_css', 'ampforwp_pagebuilder_styling', 20);
2863
-
2864
- /*
2865
- Remove Default Post Elements and make the page blank.
2866
- So Landing page builder's elements will be visible.
2867
- */
2868
- add_filter('ampforwp_design_elements', 'ampforwp_remove_post_elements');
2869
- remove_action('pre_amp_render_post', 'ampforwp_frontpage_file', 11);
2870
 
 
 
 
 
2871
  }
2872
  }
2873
 
2874
-
2875
- function ampforwp_add_landing_page_elements() {
2876
- $sanitized_sidebar = "";
2877
- $non_sanitized_sidebar = "";
2878
- $sidebar_output = "";
2879
-
2880
- ob_start();
2881
- dynamic_sidebar( 'layout-builder' );
2882
- $non_sanitized_sidebar = ob_get_contents();
2883
- ob_end_clean();
2884
-
2885
- $sanitized_sidebar = new AMPFORWP_Content( $non_sanitized_sidebar,
2886
- apply_filters( 'amp_content_embed_handlers', array(
2887
- 'AMP_Twitter_Embed_Handler' => array(),
2888
- 'AMP_YouTube_Embed_Handler' => array(),
2889
- 'AMP_Instagram_Embed_Handler' => array(),
2890
- 'AMP_Vine_Embed_Handler' => array(),
2891
- 'AMP_Facebook_Embed_Handler' => array(),
2892
- 'AMP_Gallery_Embed_Handler' => array(),
2893
- ) ),
2894
- apply_filters( 'amp_content_sanitizers', array(
2895
- 'AMP_Style_Sanitizer' => array(),
2896
- 'AMP_Blacklist_Sanitizer' => array(),
2897
- 'AMP_Img_Sanitizer' => array(),
2898
- 'AMP_Video_Sanitizer' => array(),
2899
- 'AMP_Audio_Sanitizer' => array(),
2900
- 'AMP_Iframe_Sanitizer' => array(
2901
- 'add_placeholder' => true,
2902
- ),
2903
- ) )
2904
- );
2905
-
2906
- $sidebar_output = $sanitized_sidebar->get_amp_content();
2907
- echo $sidebar_output;
2908
- }
2909
-
2910
- function ampforwp_remove_post_elements($elements) {
2911
  $elements = array('empty-filter');
2912
  return $elements ;
2913
  }
@@ -2928,6 +2886,77 @@ function ampforwp_pagebuilder_styling() { ?>
2928
  @media (max-width: 430px) { .flex-grid {display: block;} }
2929
  <?php }
2930
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2931
  /**
2932
  * 65. Remove Filters code added through Class by other plugins
2933
  *
@@ -2958,6 +2987,22 @@ function ampforwp_remove_filters_for_class( $hook_name = '', $class_name ='', $m
2958
  return false;
2959
  }
2960
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2961
 
2962
  // 66. Make AMP compatible with Squirrly SEO
2963
  add_action('pre_amp_render_post','ampforwp_remove_sq_seo');
@@ -3271,4 +3316,40 @@ function ampforwp_rel_canonical_home_archive(){
3271
  echo trailingslashit( home_url() ) ?>"> <?php
3272
  }
3273
  }
3274
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
  // 0.9. AMP Design Manager Files
87
  require 'design-manager.php';
 
88
  // Custom AMP Content
89
  require 'custom-amp-content.php';
90
  // Custom AMPFORWP Sanitizers
92
  // Custom Frontpage items
93
  require 'frontpage-elements.php';
94
  require AMPFORWP_PLUGIN_DIR . '/classes/class-ampforwp-youtube-embed.php' ;
95
+
96
+ function ampforwp_include_customizer_files(){
97
+ $amp_plugin_data;
98
+
99
+ $amp_plugin_data = get_plugin_data( AMPFORWP_MAIN_PLUGIN_DIR. 'amp/amp.php' );
100
+ if ( $amp_plugin_data['Version'] > '0.4.2' ) {
101
+ return require 'customizer/customizer-new.php' ;
102
+ } else {
103
+ return require 'customizer/customizer.php' ;
104
+ }
105
+ }
106
+ ampforwp_include_customizer_files();
107
  //0.
108
 
109
  define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
400
  // moved this code to its own function and done the AMP way
401
  }
402
  // 6.1 Adding Analytics Scripts
403
+ add_filter('amp_post_template_data','ampforwp_register_analytics_script', 20);
404
+ function ampforwp_register_analytics_script( $data ){
405
+ global $redux_builder_amp;
406
+ if( $redux_builder_amp['amp-analytics-select-option'] && $redux_builder_amp['amp-analytics-select-option'] != '3' && $redux_builder_amp['amp-analytics-select-option'] != '6' && $redux_builder_amp['amp-analytics-select-option'] != '7' && $redux_builder_amp['amp-analytics-select-option'] != '8'){
407
+ if ( empty( $data['amp_component_scripts']['amp-analytics'] ) ) {
408
+ $data['amp_component_scripts']['amp-analytics'] = 'https://cdn.ampproject.org/v0/amp-analytics-0.1.js';
409
+ }
410
+ }
411
+ return $data;
412
  }
413
 
414
  add_filter( 'amp_post_template_data', 'ampforwp_add_amp_related_scripts', 20 );
731
  // 10.2 Analytics Support added for segment.com
732
  if ( $redux_builder_amp['amp-analytics-select-option']=='2' ) { ?>
733
  <amp-analytics type="segment">
734
+ <script type="application/json">
735
  {
736
  "vars": {
737
  "writeKey": "<?php global $redux_builder_amp; echo $redux_builder_amp['sa-feild']; ?>",
778
  <?php
779
  }
780
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
781
  // 10.6 Analytics Support added for Effective Measure
782
  if( $redux_builder_amp['amp-analytics-select-option']=='6' ) { ?>
783
  <!-- BEGIN EFFECTIVE MEASURE CODE -->
1430
  }
1431
  //Removing the WPTouch Pro social share links from AMP
1432
  remove_filter( 'the_content', 'foundation_handle_share_links_bottom', 100 );
1433
+ //Removing the space added by the Google adsense #967
1434
+ remove_filter( 'the_content', 'ga_strikable_add_optimized_adsense_code');
1435
  }
1436
 
1437
  // 22. Removing author links from comments Issue #180
2845
 
2846
 
2847
  // 64. PageBuilder
2848
+ add_action('pre_amp_render_post','ampforwp_apply_layout_builder_on_pages',20);
2849
  function ampforwp_apply_layout_builder_on_pages($post_id) {
2850
  global $redux_builder_amp;
2851
 
2852
  if ( is_home() ) {
2853
  $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
2854
  }
 
2855
  $sidebar_check = get_post_meta( $post_id,'ampforwp_custom_sidebar_select',true);
2856
 
2857
  if ( $redux_builder_amp['ampforwp-content-builder'] && $sidebar_check === 'layout-builder') {
2858
+ // Add Styling Builder Elements
2859
+ add_action('amp_post_template_css', 'ampforwp_pagebuilder_styling', 20);
 
 
 
 
 
 
 
 
 
 
2860
 
2861
+ // Removed Titles for Pagebuilder elements
2862
+ remove_filter( 'ampforwp_design_elements', 'ampforwp_add_element_the_title' );
2863
+ remove_action('ampforwp_design_2_frontpage_title','ampforwp_design_2_frontpage_title');
2864
+ remove_action('ampforwp_design_2_frontpage_title','ampforwp_design_2_frontpage_title');
2865
  }
2866
  }
2867
 
2868
+ function ampforwp_remove_post_elements($elements) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2869
  $elements = array('empty-filter');
2870
  return $elements ;
2871
  }
2886
  @media (max-width: 430px) { .flex-grid {display: block;} }
2887
  <?php }
2888
 
2889
+
2890
+ // Add the scripts and style in header
2891
+ function ampforwp_generate_pagebuilder_data() {
2892
+ $sanitized_sidebar = "";
2893
+ $non_sanitized_sidebar = "";
2894
+ $sidebar_data = array();
2895
+
2896
+ ob_start();
2897
+ dynamic_sidebar( 'layout-builder' );
2898
+ $non_sanitized_sidebar = ob_get_contents();
2899
+ ob_end_clean();
2900
+
2901
+ $sanitized_sidebar = new AMPFORWP_Content( $non_sanitized_sidebar,
2902
+ apply_filters( 'amp_content_embed_handlers', array(
2903
+ 'AMP_Twitter_Embed_Handler' => array(),
2904
+ 'AMP_YouTube_Embed_Handler' => array(),
2905
+ 'AMP_Instagram_Embed_Handler' => array(),
2906
+ 'AMP_Vine_Embed_Handler' => array(),
2907
+ 'AMP_Facebook_Embed_Handler' => array(),
2908
+ 'AMP_Gallery_Embed_Handler' => array(),
2909
+ ) ),
2910
+ apply_filters( 'amp_content_sanitizers', array(
2911
+ 'AMP_Style_Sanitizer' => array(),
2912
+ 'AMP_Blacklist_Sanitizer' => array(),
2913
+ 'AMP_Img_Sanitizer' => array(),
2914
+ 'AMP_Video_Sanitizer' => array(),
2915
+ 'AMP_Audio_Sanitizer' => array(),
2916
+ 'AMP_Iframe_Sanitizer' => array(
2917
+ 'add_placeholder' => true,
2918
+ ),
2919
+ ) )
2920
+ );
2921
+
2922
+ $sidebar_data['content'] = $sanitized_sidebar->get_amp_content();
2923
+ $sidebar_data['script'] = $sanitized_sidebar->get_amp_scripts();
2924
+ $sidebar_data['style'] = $sanitized_sidebar->get_amp_styles();
2925
+
2926
+ return $sidebar_data;
2927
+ }
2928
+
2929
+ function ampforwp_builder_checker() {
2930
+ global $post, $redux_builder_amp;
2931
+ $pagebuilder_check = '';
2932
+ $post_id = '';
2933
+
2934
+ $post_id = $post->ID;
2935
+ if ( is_home() ) {
2936
+ $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
2937
+ }
2938
+ $pagebuilder_check = get_post_meta( $post_id,'ampforwp_custom_sidebar_select',true);
2939
+
2940
+ if ( $pagebuilder_check === 'layout-builder' ) {
2941
+ return ampforwp_generate_pagebuilder_data();
2942
+ }
2943
+ return;
2944
+ }
2945
+
2946
+ add_filter( 'amp_post_template_data', 'ampforwp_add_pagebuilder_data' );
2947
+ function ampforwp_add_pagebuilder_data( $data ) {
2948
+ $sanitized_data = '';
2949
+ $sanitized_data = ampforwp_builder_checker();
2950
+
2951
+ if ( $sanitized_data ) {
2952
+ $data[ 'post_amp_content' ] = $sanitized_data['content'];
2953
+ $data[ 'amp_component_scripts' ] = $sanitized_data['script'];
2954
+ $data[ 'post_amp_styles' ] = $sanitized_data['style'];
2955
+ }
2956
+
2957
+ return $data;
2958
+ }
2959
+
2960
  /**
2961
  * 65. Remove Filters code added through Class by other plugins
2962
  *
2987
  return false;
2988
  }
2989
 
2990
+ // BuddyPress Compatibility
2991
+ add_action('amp_init','ampforwp_allow_homepage_bp');
2992
+ function ampforwp_allow_homepage_bp() {
2993
+ add_action( 'wp', 'ampforwp_remove_rel_on_bp' );
2994
+ }
2995
+ function ampforwp_remove_rel_on_bp(){
2996
+ if(function_exists('bp_is_activity_component')||function_exists('bp_is_members_component')||function_exists('bp_is_groups_component'))
2997
+ {
2998
+ if(bp_is_activity_component()|| bp_is_members_component() || bp_is_groups_component()){
2999
+ remove_action( 'wp_head', 'amp_frontend_add_canonical');
3000
+ remove_action( 'wp_head', 'ampforwp_home_archive_rel_canonical' );
3001
+ }
3002
+ }
3003
+
3004
+ }
3005
+
3006
 
3007
  // 66. Make AMP compatible with Squirrly SEO
3008
  add_action('pre_amp_render_post','ampforwp_remove_sq_seo');
3316
  echo trailingslashit( home_url() ) ?>"> <?php
3317
  }
3318
  }
3319
+ }
3320
+
3321
+ //Alt tag for thumbnails #1013
3322
+ function ampforwp_thumbnail_alt(){
3323
+ $thumb_id = '';
3324
+ $thumb_alt = '';
3325
+ $thumb_id = get_post_thumbnail_id();
3326
+ $thumb_alt = get_post_meta( $thumb_id, '_wp_attachment_image_alt', true);
3327
+
3328
+ if($thumb_alt){
3329
+ echo "alt = '$thumb_alt'";
3330
+ }
3331
+ }
3332
+ // For Post ID in Body tag
3333
+ function ampforwp_get_body_class(){
3334
+
3335
+ global $post;
3336
+ global $redux_builder_amp;
3337
+ $post_id = '';
3338
+
3339
+ if ( is_singular() ) {
3340
+ $post_id = $post->ID;
3341
+ }
3342
+ if ( $redux_builder_amp['amp-frontpage-select-option']) {
3343
+ if ( is_home() && is_front_page() ) {
3344
+ $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
3345
+ } elseif ( is_home() ){
3346
+ $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
3347
+ }
3348
+ }
3349
+
3350
+ return $post_id;
3351
+ }
3352
+
3353
+ function ampforwp_the_body_class(){
3354
+ echo 'post-id-' . ampforwp_get_body_class();
3355
+ }#1006 Pegazee