AMP for WP – Accelerated Mobile Pages - Version 0.9.3

Version Description

[31th December 2016] = * Proper Details at https://ampforwp.com/custom-amp-content-editor/ * Custom AMP Editor - Which allows you to override your Content that you had written in Post or page, so you can add the different content just for AMP. * FrontPage had some validation issues. [Bug fix] * Related posts in Design 1 we're redirecting to 404 fixed [Bug fix]

Download this release

Release Info

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

Code changes from version 0.9.2.2.1 to 0.9.3

README.md CHANGED
@@ -7,7 +7,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
7
  Donate link: https://www.paypal.me/Kaludi/5
8
  Requires at least: 3.0
9
  Tested up to: 4.7
10
- Stable tag: 0.9.2.2
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -78,9 +78,13 @@ Automatically add Accelerated Mobile Pages (Google AMP Project) functionality on
78
 
79
  = Getting Started: =
80
  **[1. User Documentation:](http://ampforwp.com/help/)** The AMP for WP plugin is easy to setup but we have some tutorials and guides prepared for you which will help you dive deep with the plugin.
 
81
  **[2. Developer Docs:](https://ampforwp.com/help/#extend)** We have created special documentations for developers and semi technical users who are willing to modify the plugin according to their own needs.
 
82
  **[3. Fixing AMP Validation Errors:](https://ampforwp.com/priority-support/#utm_source=wp_org&utm_medium=description-tab-pro-box&utm_campaign=AMP%20Plugin)** We will personally take care that your website’s AMP version is perfectly validated. We will make sure that your AMP version gets approved and indexed by Google Webmaster Tools properly and we will even keep an eye on AMP updates from Google and implement them into your website.
 
83
  **[4. Community Support Forum:](https://ampforwp.com/help/#support-forum)** We have a special community support forum where you can ask us questions and get help about your AMP related questions. Delivering a good user experience means alot to us and so we try our best to reply each and every question that gets asked.
 
84
  **[5. Frequently Asked Questions:](http://ampforwp.com/faq/)** Some of the Frequently Asked questions.
85
 
86
  = Issues & Bug Reports: =
@@ -122,6 +126,12 @@ You can contact me using this url: http://ampforwp.com/contact/
122
 
123
  == Changelog ==
124
 
 
 
 
 
 
 
125
  = 0.9.2.2 [27th December 2016] =
126
  * Proper Details at https://ampforwp.com/polishing-user-experience-improvements/
127
  * Made the Options panel user-friendly
7
  Donate link: https://www.paypal.me/Kaludi/5
8
  Requires at least: 3.0
9
  Tested up to: 4.7
10
+ Stable tag: 0.9.3
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
78
 
79
  = Getting Started: =
80
  **[1. User Documentation:](http://ampforwp.com/help/)** The AMP for WP plugin is easy to setup but we have some tutorials and guides prepared for you which will help you dive deep with the plugin.
81
+
82
  **[2. Developer Docs:](https://ampforwp.com/help/#extend)** We have created special documentations for developers and semi technical users who are willing to modify the plugin according to their own needs.
83
+
84
  **[3. Fixing AMP Validation Errors:](https://ampforwp.com/priority-support/#utm_source=wp_org&utm_medium=description-tab-pro-box&utm_campaign=AMP%20Plugin)** We will personally take care that your website’s AMP version is perfectly validated. We will make sure that your AMP version gets approved and indexed by Google Webmaster Tools properly and we will even keep an eye on AMP updates from Google and implement them into your website.
85
+
86
  **[4. Community Support Forum:](https://ampforwp.com/help/#support-forum)** We have a special community support forum where you can ask us questions and get help about your AMP related questions. Delivering a good user experience means alot to us and so we try our best to reply each and every question that gets asked.
87
+
88
  **[5. Frequently Asked Questions:](http://ampforwp.com/faq/)** Some of the Frequently Asked questions.
89
 
90
  = Issues & Bug Reports: =
126
 
127
  == Changelog ==
128
 
129
+ = 0.9.3 [31th December 2016] =
130
+ * Proper Details at https://ampforwp.com/custom-amp-content-editor/
131
+ * Custom AMP Editor - Which allows you to override your Content that you had written in Post or page, so you can add the different content just for AMP.
132
+ * FrontPage had some validation issues. [Bug fix]
133
+ * Related posts in Design 1 we're redirecting to 404 fixed [Bug fix]
134
+
135
  = 0.9.2.2 [27th December 2016] =
136
  * Proper Details at https://ampforwp.com/polishing-user-experience-improvements/
137
  * Made the Options panel user-friendly
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.2.2.1
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: http://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/5
@@ -26,7 +26,7 @@ add_action( 'init', 'ampforwp_add_custom_post_support',11);
26
 
27
  define('AMPFORWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
28
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
29
- define('AMPFORWP_VERSION','0.9.2.2');
30
 
31
  /*
32
  * Load Files only in the backend
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
+ Version: 0.9.3
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: http://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/5
26
 
27
  define('AMPFORWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
28
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
29
+ define('AMPFORWP_VERSION','0.9.3');
30
 
31
  /*
32
  * Load Files only in the backend
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.2.2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -29,11 +29,11 @@ Automatically add Accelerated Mobile Pages (Google AMP Project) functionality on
29
 
30
  = Features: =
31
 
 
32
  * NEW - Mobile Redirection - More than 50% of your traffic is from mobile and you aren’t doing anything to improve their user experience, which means you are falling behind on SEO and it can result in lower SERPS. Lightning fast mobile version means faster User experience means more engagement which directly results in the lower bounce rate.
33
- * NEW - DoubleClick Support
34
  * NEW - Custom Post Type Support
35
  * NEW - Star Ratings
36
- * NEW - Drag & Drop Page builder Added
37
  * 2 Designs Added
38
  * Yoast SEO support on AMP pages
39
  * AMP WooCommerce Support
@@ -67,6 +67,7 @@ Automatically add Accelerated Mobile Pages (Google AMP Project) functionality on
67
  * Custom AMP FrontPage
68
  * Notifications
69
  * Piwik & Segment.com Support
 
70
  * Great Support & Active Development.
71
 
72
  **NOTE:** Next Update of this plugin will be released by end of Dec 2016.
@@ -75,9 +76,13 @@ Automatically add Accelerated Mobile Pages (Google AMP Project) functionality on
75
 
76
  = Getting Started: =
77
  **[1. User Documentation:](http://ampforwp.com/help/)** The AMP for WP plugin is easy to setup but we have some tutorials and guides prepared for you which will help you dive deep with the plugin.
 
78
  **[2. Developer Docs:](https://ampforwp.com/help/#extend)** We have created special documentations for developers and semi technical users who are willing to modify the plugin according to their own needs.
 
79
  **[3. Fixing AMP Validation Errors:](https://ampforwp.com/priority-support/#utm_source=wp_org&utm_medium=description-tab-pro-box&utm_campaign=AMP%20Plugin)** We will personally take care that your website’s AMP version is perfectly validated. We will make sure that your AMP version gets approved and indexed by Google Webmaster Tools properly and we will even keep an eye on AMP updates from Google and implement them into your website.
 
80
  **[4. Community Support Forum:](https://ampforwp.com/help/#support-forum)** We have a special community support forum where you can ask us questions and get help about your AMP related questions. Delivering a good user experience means alot to us and so we try our best to reply each and every question that gets asked.
 
81
  **[5. Frequently Asked Questions:](http://ampforwp.com/faq/)** Some of the Frequently Asked questions.
82
 
83
  = Issues & Bug Reports: =
@@ -119,6 +124,12 @@ You can contact me using this url: http://ampforwp.com/contact/
119
 
120
  == Changelog ==
121
 
 
 
 
 
 
 
122
  = 0.9.2.2 [27th December 2016] =
123
  * Proper Details at https://ampforwp.com/polishing-user-experience-improvements/
124
  * Made the Options panel user-friendly
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.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
29
 
30
  = Features: =
31
 
32
+ * NEW - Custom AMP Editor - Which allows you to override your Content that you had written in Post or page, so you can add the different content just for AMP.
33
  * NEW - Mobile Redirection - More than 50% of your traffic is from mobile and you aren’t doing anything to improve their user experience, which means you are falling behind on SEO and it can result in lower SERPS. Lightning fast mobile version means faster User experience means more engagement which directly results in the lower bounce rate.
 
34
  * NEW - Custom Post Type Support
35
  * NEW - Star Ratings
36
+ * Drag & Drop Page builder Added
37
  * 2 Designs Added
38
  * Yoast SEO support on AMP pages
39
  * AMP WooCommerce Support
67
  * Custom AMP FrontPage
68
  * Notifications
69
  * Piwik & Segment.com Support
70
+ * Incontent & DoubleClick Support
71
  * Great Support & Active Development.
72
 
73
  **NOTE:** Next Update of this plugin will be released by end of Dec 2016.
76
 
77
  = Getting Started: =
78
  **[1. User Documentation:](http://ampforwp.com/help/)** The AMP for WP plugin is easy to setup but we have some tutorials and guides prepared for you which will help you dive deep with the plugin.
79
+
80
  **[2. Developer Docs:](https://ampforwp.com/help/#extend)** We have created special documentations for developers and semi technical users who are willing to modify the plugin according to their own needs.
81
+
82
  **[3. Fixing AMP Validation Errors:](https://ampforwp.com/priority-support/#utm_source=wp_org&utm_medium=description-tab-pro-box&utm_campaign=AMP%20Plugin)** We will personally take care that your website’s AMP version is perfectly validated. We will make sure that your AMP version gets approved and indexed by Google Webmaster Tools properly and we will even keep an eye on AMP updates from Google and implement them into your website.
83
+
84
  **[4. Community Support Forum:](https://ampforwp.com/help/#support-forum)** We have a special community support forum where you can ask us questions and get help about your AMP related questions. Delivering a good user experience means alot to us and so we try our best to reply each and every question that gets asked.
85
+
86
  **[5. Frequently Asked Questions:](http://ampforwp.com/faq/)** Some of the Frequently Asked questions.
87
 
88
  = Issues & Bug Reports: =
124
 
125
  == Changelog ==
126
 
127
+ = 0.9.3 [31th December 2016] =
128
+ * Proper Details at https://ampforwp.com/custom-amp-content-editor/
129
+ * Custom AMP Editor - Which allows you to override your Content that you had written in Post or page, so you can add the different content just for AMP.
130
+ * FrontPage had some validation issues. [Bug fix]
131
+ * Related posts in Design 1 we're redirecting to 404 fixed [Bug fix]
132
+
133
  = 0.9.2.2 [27th December 2016] =
134
  * Proper Details at https://ampforwp.com/polishing-user-experience-improvements/
135
  * Made the Options panel user-friendly
templates/custom-amp-content.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Adding Custom meta Sanitizer to sanitize the custom content added throught tinymce post meta
3
+ add_filter( 'amp_post_template_data', 'ampforwp_custom_post_content_sanitizer', 10, 2 );
4
+ function ampforwp_custom_post_content_sanitizer( $data, $post ) {
5
+
6
+ $amp_custom_post_content_input = get_post_meta($post->ID, 'ampforwp_custom_content_editor', true);
7
+
8
+ if ( empty( $amp_custom_post_content_input ) ) {
9
+ $data['ampforwp_amp_content'] = false;
10
+ return $data;
11
+ }
12
+
13
+ $amp_custom_content = new AMP_Content( $amp_custom_post_content_input,
14
+ apply_filters( 'amp_content_embed_handlers', array(
15
+ 'AMP_Twitter_Embed_Handler' => array(),
16
+ 'AMP_YouTube_Embed_Handler' => array(),
17
+ 'AMP_Instagram_Embed_Handler' => array(),
18
+ 'AMP_Vine_Embed_Handler' => array(),
19
+ 'AMP_Facebook_Embed_Handler' => array(),
20
+ 'AMP_Gallery_Embed_Handler' => array(),
21
+ ) ),
22
+ apply_filters( 'amp_content_sanitizers', array(
23
+ 'AMP_Blacklist_Sanitizer' => array(),
24
+ 'AMP_Img_Sanitizer' => array(),
25
+ 'AMP_Video_Sanitizer' => array(),
26
+ 'AMP_Audio_Sanitizer' => array(),
27
+ 'AMP_Iframe_Sanitizer' => array(
28
+ 'add_placeholder' => true,
29
+ ),
30
+ ) )
31
+ );
32
+
33
+ if ( $amp_custom_content ) {
34
+ $data[ 'ampforwp_amp_content' ] = $amp_custom_content->get_amp_content();
35
+ $data['amp_component_scripts'] = $amp_custom_content->get_amp_scripts();
36
+ $data['post_amp_styles'] = $amp_custom_content->get_amp_styles();
37
+ }
38
+
39
+ return $data;
40
+ }
41
+
42
+
43
+ function ampforwp_custom_content_meta_register() {
44
+
45
+ add_meta_box( 'custom_content_editor', esc_html__( 'Custom AMP Editor' ), 'amp_content_editor_title_callback', 'post','normal', 'default' );
46
+
47
+ add_meta_box( 'custom_content_editor', esc_html__( 'Custom AMP Editor' ), 'amp_content_editor_title_callback', 'page','normal', 'default' );
48
+
49
+ }
50
+ add_action('add_meta_boxes','ampforwp_custom_content_meta_register');
51
+
52
+
53
+ function amp_content_editor_title_callback( $post ) {
54
+
55
+ wp_nonce_field( basename( __FILE__) , 'amp_content_editor_nonce' );
56
+ $amp_content_on_off = get_post_meta($post->ID, 'ampforwp_custom_content_editor_checkbox', true);
57
+ $amp_content_on_off = esc_attr($amp_content_on_off);
58
+ ?>
59
+ <!--HTML content starts here-->
60
+
61
+ <label for="meta-checkbox">
62
+ <p>
63
+ <input type="checkbox" name="ampforwp_custom_content_editor_checkbox" id="meta-checkbox" value="yes" <?php if ( isset ( $amp_content_on_off ) ) checked( $amp_content_on_off, 'yes' ); ?> />
64
+ <?php _e( 'Use This Content as AMP Content' )?> </p>
65
+ </label>
66
+
67
+ <!--HTML content Ends here-->
68
+ <?php
69
+ $content = get_post_meta ( $post->ID, 'ampforwp_custom_content_editor', true );
70
+ $editor_id = 'ampforwp_custom_content_editor';
71
+ wp_editor( $content, $editor_id );
72
+ }
73
+
74
+ // Save Rating Meta Field function
75
+ function amp_content_editor_meta_save ( $post_id ) {
76
+ // Checks save status
77
+ $is_autosave = wp_is_post_autosave( $post_id );
78
+ $is_revision = wp_is_post_revision( $post_id );
79
+ $is_valid_nonce = ( isset( $_POST[ 'amp_content_editor_nonce' ] ) && wp_verify_nonce( $_POST[ 'amp_content_editor_nonce' ], basename( __FILE__ ) ) ) ? 'true' : 'false';
80
+
81
+ // Exits script depending on save status
82
+ if ( $is_autosave || $is_revision || !$is_valid_nonce ) {
83
+ return;
84
+ }
85
+
86
+ //if there is data to be saved to DB
87
+ if ( isset( $_POST['ampforwp_custom_content_editor'] ) ) {
88
+ update_post_meta($post_id, 'ampforwp_custom_content_editor', $_POST[ 'ampforwp_custom_content_editor' ] );
89
+ }
90
+ }
91
+
92
+ add_action ( 'save_post' , 'amp_content_editor_meta_save' );
93
+
94
+ // Save Rating Meta Field function
95
+ function amp_checkbox_meta_save ( $post_id ) {
96
+ // Checks save status
97
+ $is_autosave = wp_is_post_autosave( $post_id );
98
+ $is_revision = wp_is_post_revision( $post_id );
99
+ $is_valid_nonce = ( isset( $_POST[ 'amp_content_editor_nonce' ] ) && wp_verify_nonce( $_POST[ 'amp_content_editor_nonce' ], basename( __FILE__ ) ) ) ? 'true' : 'false';
100
+
101
+ // Exits script depending on save status
102
+ if ( $is_autosave || $is_revision || !$is_valid_nonce ) {
103
+ return;
104
+ }
105
+
106
+ //if there is data to be saved to DB
107
+ if ( isset( $_POST['ampforwp_custom_content_editor_checkbox'] ) ) {
108
+ update_post_meta($post_id, 'ampforwp_custom_content_editor_checkbox', $_POST[ 'ampforwp_custom_content_editor_checkbox' ] );
109
+ } else {
110
+ update_post_meta($post_id, 'ampforwp_custom_content_editor_checkbox', '');
111
+ }
112
+ }
113
+
114
+ add_action ( 'save_post' , 'amp_checkbox_meta_save' );
115
+
116
+
117
+ ?>
templates/design-manager/design-1/elements/content.php CHANGED
@@ -1,7 +1,16 @@
1
- <div class="amp-wp-article-content">
2
- <?php do_action('ampforwp_inside_post_content_before') ?>
 
 
 
 
 
 
 
 
 
 
3
 
4
- <?php echo $this->get( 'post_amp_content' ); // amphtml content; no kses ?>
5
-
6
- <?php do_action('ampforwp_inside_post_content_after') ?>
7
  </div>
1
+ <div class="amp-wp-article-content"> <?php
2
+
3
+ do_action('ampforwp_inside_post_content_before');
4
+ $amp_custom_content_enable = get_post_meta( $this->get( 'post_id' ) , 'ampforwp_custom_content_editor_checkbox', true);
5
+
6
+ // Normal Front Page Content
7
+ if ( ! $amp_custom_content_enable ) {
8
+ echo $this->get( 'post_amp_content' ); // amphtml content; no kses
9
+ } else {
10
+ // Custom/Alternative AMP content added through post meta
11
+ echo $this->get( 'ampforwp_amp_content' );
12
+ }
13
 
14
+ do_action('ampforwp_inside_post_content_after') ?>
15
+
 
16
  </div>
templates/design-manager/design-1/elements/related-posts.php CHANGED
@@ -38,9 +38,13 @@
38
  <h3><?php echo esc_html( $redux_builder_amp['amp-translator-related-text'] ); ?></h3>
39
  <?php
40
  while( $my_query->have_posts() ) {
41
- $my_query->the_post();?>
 
 
 
 
42
  <li class="<?php if ( has_post_thumbnail() ) { echo'has_related_thumbnail'; } else { echo 'no_related_thumbnail'; } ?>">
43
- <a href="<?php trailingslashit(the_permalink()); ?><?php echo AMP_QUERY_VAR ;?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
44
  <?php if ( has_post_thumbnail() ) {
45
  $thumb_id_2 = get_post_thumbnail_id();
46
  $thumb_url_array_2 = wp_get_attachment_image_src($thumb_id_2, 'thumbnail', true);
@@ -49,7 +53,7 @@
49
  <?php } ?>
50
  </a>
51
  <div class="related_link">
52
- <a href="<?php trailingslashit(the_permalink()); ?><?php echo AMP_QUERY_VAR ;?>"><?php the_title(); ?></a>
53
  <?php
54
  if(has_excerpt()){
55
  $content = get_the_excerpt();
38
  <h3><?php echo esc_html( $redux_builder_amp['amp-translator-related-text'] ); ?></h3>
39
  <?php
40
  while( $my_query->have_posts() ) {
41
+ $my_query->the_post();
42
+ $related_post_permalink = get_permalink();
43
+ $related_post_permalink = trailingslashit($related_post_permalink);
44
+ $related_post_permalink = $related_post_permalink . AMP_QUERY_VAR
45
+ ?>
46
  <li class="<?php if ( has_post_thumbnail() ) { echo'has_related_thumbnail'; } else { echo 'no_related_thumbnail'; } ?>">
47
+ <a href="<?php echo esc_url( $related_post_permalink ); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
48
  <?php if ( has_post_thumbnail() ) {
49
  $thumb_id_2 = get_post_thumbnail_id();
50
  $thumb_url_array_2 = wp_get_attachment_image_src($thumb_id_2, 'thumbnail', true);
53
  <?php } ?>
54
  </a>
55
  <div class="related_link">
56
+ <a href="<?php echo esc_url( $related_post_permalink ); ?>"><?php the_title(); ?></a>
57
  <?php
58
  if(has_excerpt()){
59
  $content = get_the_excerpt();
templates/design-manager/design-1/frontpage.php CHANGED
@@ -1,11 +1,17 @@
1
- <?php global $redux_builder_amp; ?>
 
 
2
  <!doctype html>
3
  <html amp>
4
  <head>
5
  <meta charset="utf-8">
6
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
7
  <?php do_action( 'amp_post_template_head', $this ); ?>
8
-
 
 
 
 
9
  <style amp-custom>
10
  <?php $this->load_parts( array( 'style' ) ); ?>
11
  <?php do_action( 'amp_post_template_css', $this ); ?>
@@ -14,32 +20,30 @@
14
  <body class="single-post amp-wp-frontpage">
15
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
16
 
17
- <?php
18
- // do_action( 'ampforwp_after_header', $this );
19
- ?>
20
 
 
21
 
22
- <div class="amp-wp-content the_content">
23
- <?php do_action( 'ampforwp_before_post_content', $this ); ?>
24
 
25
- <?php
26
- global $redux_demo;
27
- //echo 'Multi Select value: ' . $redux_builder_amp['amp-frontpage-select-option-pages'];
28
- ?>
29
 
30
- <?php $the_query = new WP_Query( 'page_id=' . $redux_builder_amp['amp-frontpage-select-option-pages'] . '' ); ?>
31
- <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
32
- <?php the_content(); ?>
33
- <?php endwhile;?>
 
 
 
34
 
35
- <?php do_action( 'ampforwp_after_post_content', $this ); ?>
 
 
36
  </div>
37
 
38
  <div class="amp-wp-content post-pagination-meta">
39
  <?php $this->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
40
-
41
-
42
-
43
  </div>
44
 
45
  <?php if($redux_builder_amp['enable-single-social-icons'] == true) { ?>
1
+ <?php global $redux_builder_amp;
2
+ $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
3
+ $template = new AMP_Post_Template( $post_id );?>
4
  <!doctype html>
5
  <html amp>
6
  <head>
7
  <meta charset="utf-8">
8
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
9
  <?php do_action( 'amp_post_template_head', $this ); ?>
10
+ <?php
11
+ $amp_component_scripts = $template->data['amp_component_scripts'];
12
+ foreach ($amp_component_scripts as $ampforwp_service => $ampforwp_js_file) { ?>
13
+ <script custom-element="<?php echo $ampforwp_service; ?>" src="<?php echo $ampforwp_js_file; ?>" async></script> <?php
14
+ } ?>
15
  <style amp-custom>
16
  <?php $this->load_parts( array( 'style' ) ); ?>
17
  <?php do_action( 'amp_post_template_css', $this ); ?>
20
  <body class="single-post amp-wp-frontpage">
21
  <?php $this->load_parts( array( 'header-bar' ) ); ?>
22
 
23
+ <?php do_action( 'ampforwp_after_header', $this ); ?>
24
+
25
+ <div class="amp-wp-content the_content"> <?php
26
 
27
+ do_action( 'ampforwp_before_post_content', $this );
28
 
29
+ $amp_custom_content_enable = get_post_meta($template->data['post_id'], 'ampforwp_custom_content_editor_checkbox', true);
 
30
 
 
 
 
 
31
 
32
+ // Normal Front Page Content
33
+ if ( ! $amp_custom_content_enable ) {
34
+ echo $template->data['post_amp_content'];
35
+ } else {
36
+ // Custom/Alternative AMP content added through post meta
37
+ echo $template->data['ampforwp_amp_content'];
38
+ }
39
 
40
+ do_action( 'ampforwp_after_post_content', $this );
41
+ ?>
42
+
43
  </div>
44
 
45
  <div class="amp-wp-content post-pagination-meta">
46
  <?php $this->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
 
 
 
47
  </div>
48
 
49
  <?php if($redux_builder_amp['enable-single-social-icons'] == true) { ?>
templates/design-manager/design-2/elements/content.php CHANGED
@@ -5,7 +5,19 @@
5
 
6
  <?php do_action('ampforwp_before_post_content') //Post before Content here ?>
7
 
8
- <?php echo $this->get( 'post_amp_content' ); // amphtml content; no kses ?>
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  <?php do_action('ampforwp_after_post_content') ; //Post After Content here ?>
11
 
5
 
6
  <?php do_action('ampforwp_before_post_content') //Post before Content here ?>
7
 
8
+ <?php
9
+ $amp_custom_content_enable = get_post_meta( $this->get( 'post_id' ) , 'ampforwp_custom_content_editor_checkbox', true);
10
+
11
+ // Normal Front Page Content
12
+ if ( ! $amp_custom_content_enable ) {
13
+ echo $this->get( 'post_amp_content' ); // amphtml content; no kses
14
+ } else {
15
+ // Custom/Alternative AMP content added through post meta
16
+ echo $this->get( 'ampforwp_amp_content' );
17
+ }
18
+
19
+ // echo $this->get( 'post_amp_content' ); // amphtml content; no kses
20
+ ?>
21
 
22
  <?php do_action('ampforwp_after_post_content') ; //Post After Content here ?>
23
 
templates/design-manager/design-2/frontpage.php CHANGED
@@ -1,11 +1,17 @@
1
- <?php global $redux_builder_amp; ?>
 
 
2
  <!doctype html>
3
  <html amp>
4
  <head>
5
  <meta charset="utf-8">
6
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
7
  <?php do_action( 'amp_post_template_head', $this ); ?>
8
-
 
 
 
 
9
  <style amp-custom>
10
  <?php $this->load_parts( array( 'style' ) ); ?>
11
  <?php do_action( 'amp_post_template_css', $this ); ?>
@@ -17,27 +23,25 @@
17
  <?php do_action( 'ampforwp_after_header', $this ); ?>
18
 
19
  <main>
20
- <div class="amp-wp-content the_content">
21
- <?php do_action( 'ampforwp_before_post_content', $this ); ?>
 
 
22
 
23
- <?php
24
- global $redux_demo;
25
- //echo 'Multi Select value: ' . $redux_builder_amp['amp-frontpage-select-option-pages'];
26
- ?>
 
 
 
27
 
28
- <?php $the_query = new WP_Query( 'page_id=' . $redux_builder_amp['amp-frontpage-select-option-pages'] . '' ); ?>
29
- <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
30
- <?php the_content(); ?>
31
- <?php endwhile;?>
32
 
33
- <?php do_action( 'ampforwp_after_post_content', $this ); ?>
34
  </div>
35
 
36
  <div class="amp-wp-content post-pagination-meta">
37
  <?php $this->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
38
-
39
-
40
-
41
  </div>
42
 
43
  <?php if($redux_builder_amp['enable-single-social-icons'] == true) { ?>
1
+ <?php global $redux_builder_amp;
2
+ $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
3
+ $template = new AMP_Post_Template( $post_id );?>
4
  <!doctype html>
5
  <html amp>
6
  <head>
7
  <meta charset="utf-8">
8
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
9
  <?php do_action( 'amp_post_template_head', $this ); ?>
10
+ <?php
11
+ $amp_component_scripts = $template->data['amp_component_scripts'];
12
+ foreach ($amp_component_scripts as $ampforwp_service => $ampforwp_js_file) { ?>
13
+ <script custom-element="<?php echo $ampforwp_service; ?>" src="<?php echo $ampforwp_js_file; ?>" async></script> <?php
14
+ } ?>
15
  <style amp-custom>
16
  <?php $this->load_parts( array( 'style' ) ); ?>
17
  <?php do_action( 'amp_post_template_css', $this ); ?>
23
  <?php do_action( 'ampforwp_after_header', $this ); ?>
24
 
25
  <main>
26
+ <div class="amp-wp-content the_content"> <?php
27
+
28
+ $amp_custom_content_enable = get_post_meta($template->data['post_id'], 'ampforwp_custom_content_editor_checkbox', true);
29
+
30
 
31
+ // Normal Front Page Content
32
+ if ( ! $amp_custom_content_enable ) {
33
+ echo $template->data['post_amp_content'];
34
+ } else {
35
+ // Custom/Alternative AMP content added through post meta
36
+ echo $template->data['ampforwp_amp_content'];
37
+ }
38
 
39
+ do_action( 'ampforwp_after_post_content', $this ); ?>
 
 
 
40
 
 
41
  </div>
42
 
43
  <div class="amp-wp-content post-pagination-meta">
44
  <?php $this->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
 
 
 
45
  </div>
46
 
47
  <?php if($redux_builder_amp['enable-single-social-icons'] == true) { ?>
templates/features.php CHANGED
@@ -43,6 +43,9 @@
43
  require 'design-manager.php';
44
  require 'customizer/customizer.php';
45
 
 
 
 
46
  // 1. Add Home REL canonical
47
  // Add AMP rel-canonical for home and archive pages
48
 
43
  require 'design-manager.php';
44
  require 'customizer/customizer.php';
45
 
46
+ // Custom AMP Content
47
+ require 'custom-amp-content.php';
48
+
49
  // 1. Add Home REL canonical
50
  // Add AMP rel-canonical for home and archive pages
51