AMP for WP – Accelerated Mobile Pages - Version 0.9.54

Version Description

(4th July 2017) = * View more details on https://ampforwp.com/new/ * Facebook Instant Articles Support #862 * Exclude Some Pages from Mobile Redirection #914 * After 0.9.53 update amp-social-share js missing (critical issue) #924 * Hooks added in Header (above and below) * View non AMP[Code improvement] #928 * Pages are not supposed to show meta like this, especially Categories #894 * Monarch plugin having design issues #925 * Show AMP Hide AMP Check Box Fixes #794

Download this release

Release Info

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

Code changes from version 0.9.53 to 0.9.54

README.md CHANGED
@@ -1,10 +1,10 @@
1
  === AMP for WP - Accelerated Mobile Pages ===
2
  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.53
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -82,6 +82,7 @@ Bug reports for AMP for WP are [welcomed on GitHub](https://github.com/ahmedkalu
82
  * Incontent & DoubleClick Support
83
  * Great Support & Active Development.
84
  * Widgets & WooCommerce
 
85
 
86
  **[JOIN CHAT GROUP COMMUNITY](http://ampforwp.com/community/)**: Purpose of this group is to get proper suggestions and feedback from plugin users and the community so that we can make the plugin even better.
87
 
@@ -135,6 +136,17 @@ You can contact me using this url: http://ampforwp.com/contact/
135
 
136
  == Changelog ==
137
 
 
 
 
 
 
 
 
 
 
 
 
138
  = 0.9.53 (19th June 2017) =
139
  * View more details on https://ampforwp.com/stability-validation-issues-59th-update/
140
  * Compatibility Issue with Rocket Lazy Load plugin #907
1
  === AMP for WP - Accelerated Mobile Pages ===
2
  Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
+ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO, Instant Articles
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.54
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
82
  * Incontent & DoubleClick Support
83
  * Great Support & Active Development.
84
  * Widgets & WooCommerce
85
+ * NEW - Facebook Instant Articles Support Added
86
 
87
  **[JOIN CHAT GROUP COMMUNITY](http://ampforwp.com/community/)**: Purpose of this group is to get proper suggestions and feedback from plugin users and the community so that we can make the plugin even better.
88
 
136
 
137
  == Changelog ==
138
 
139
+ = 0.9.54 (4th July 2017) =
140
+ * View more details on https://ampforwp.com/new/
141
+ * Facebook Instant Articles Support #862
142
+ * Exclude Some Pages from Mobile Redirection #914
143
+ * After 0.9.53 update amp-social-share js missing (critical issue) #924
144
+ * Hooks added in Header (above and below)
145
+ * View non AMP[Code improvement] #928
146
+ * Pages are not supposed to show meta like this, especially Categories #894
147
+ * Monarch plugin having design issues #925
148
+ * Show AMP Hide AMP Check Box Fixes #794
149
+
150
  = 0.9.53 (19th June 2017) =
151
  * View more details on https://ampforwp.com/stability-validation-issues-59th-update/
152
  * Compatibility Issue with Rocket Lazy Load plugin #907
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.53
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -17,7 +17,7 @@ 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.53');
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.54
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_VERSION','0.9.54');
21
  // any changes to AMP_QUERY_VAR should be refelected here
22
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
23
 
classes/class-init.php CHANGED
@@ -12,6 +12,7 @@ if ( ! class_exists( 'Ampforwp_Loader', false ) ) {
12
  public function load_required_files() {
13
 
14
  require AMPFORWP_PLUGIN_DIR . '/templates/features.php';
 
15
 
16
  }
17
  }
12
  public function load_required_files() {
13
 
14
  require AMPFORWP_PLUGIN_DIR . '/templates/features.php';
15
+ require AMPFORWP_PLUGIN_DIR . '/templates/instant-articles/instant-article-sanitizer.php';
16
 
17
  }
18
  }
feeds/instant-article-feed.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
3
+ $more = 1;
4
+
5
+ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
6
+ ?>
7
+
8
+ <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
9
+
10
+ <channel>
11
+ <title><?php bloginfo_rss('name'); ?></title>
12
+ <link><?php bloginfo_rss('url') ?></link>
13
+ <description><?php bloginfo_rss("description") ?></description>
14
+ <lastBuildDate><?php echo mysql2date('c', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
15
+ <language><?php bloginfo_rss( 'language' ); ?></language>
16
+
17
+ <?php
18
+ $args = array(
19
+ 'meta_query' => $meta_query,
20
+ 'post_status' => 'publish'
21
+ );
22
+ $query = new WP_Query( $args );
23
+ $rendered_posts = 0;
24
+
25
+ while( $query->have_posts() ) :
26
+
27
+ $query->the_post();
28
+
29
+ // only show up to 50 rendered posts
30
+ $rendered_posts += 1;
31
+ if ( $rendered_posts > 50 ) {
32
+ break;
33
+ }
34
+ ?>
35
+
36
+ <item>
37
+ <title><?php the_title_rss() ?></title>
38
+ <link><?php the_permalink_rss() ?></link>
39
+ <guid><?php the_guid(); ?></guid>
40
+ <pubDate><?php echo mysql2date('c', get_post_time('c', true), false); ?></pubDate>
41
+ <author><?php the_author() ?></author>
42
+ <description><?php the_excerpt_rss(); ?></description>
43
+ <content:encoded>
44
+ <![CDATA[
45
+ <?php
46
+ $template_file = AMPFORWP_PLUGIN_DIR . 'templates/instant-articles/instant-article.php';
47
+ load_template($template_file, false);
48
+ ?>
49
+ ]]>
50
+ </content:encoded>
51
+ </item>
52
+
53
+ <?php endwhile; ?>
54
+ </channel>
55
+ </rss>
includes/options/admin-config.php CHANGED
@@ -910,6 +910,21 @@ Redux::setArgs( "redux_builder_amp", $args );
910
  'validate' => 'numeric',
911
  'default' => '3',
912
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
913
 
914
  // array(
915
  // 'id' => 'ampforwp-comments-banner',
@@ -2443,6 +2458,41 @@ Redux::setSection( $opt_name, array(
2443
 
2444
  ) );
2445
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2446
 
2447
  // Extension Section
2448
  Redux::setSection( $opt_name, array(
910
  'validate' => 'numeric',
911
  'default' => '3',
912
  ),
913
+ // Pages
914
+ array(
915
+ 'id' => 'Page',
916
+ 'type' => 'section',
917
+ 'title' => __('Pages', 'accelerated-mobile-pages'),
918
+ 'indent' => true,
919
+ ),
920
+ // Meta ON/OFF Pages
921
+ array(
922
+ 'id' => 'meta_page',
923
+ 'type' => 'switch',
924
+ 'default' => '0',
925
+ 'title' => __('Meta For Pages', 'accelerated-mobile-pages'),
926
+ 'subtitle' => __('Enable or disable the Meta on Pages'),
927
+ ),
928
 
929
  // array(
930
  // 'id' => 'ampforwp-comments-banner',
2458
 
2459
  ) );
2460
 
2461
+ function fb_instant_article(){
2462
+ $feedname = '';
2463
+ $fb_instant_article_feed = '';
2464
+ $feedname = 'instant_articles';
2465
+ $fb_instant_article_feed = trailingslashit( site_url() ).$feedname ;
2466
+ return esc_url( $fb_instant_article_feed );
2467
+ }
2468
+ // Facebook Instant Articles
2469
+ Redux::setSection( $opt_name, array(
2470
+ 'title' => __( 'Facebook Instant Articles', 'accelerated-mobile-pages' ),
2471
+ 'id' => 'fb-instant-article',
2472
+ 'subsection' => true,
2473
+ 'fields' => array(
2474
+ array(
2475
+ 'id' =>'fb-instant-article-switch',
2476
+ 'type' => 'switch',
2477
+ 'title' => __('Facebook Instant Articles Support', 'accelerated-mobile-pages'),
2478
+ 'default' => 0,
2479
+ 'true' => 'true',
2480
+ 'false' => 'false',
2481
+ 'desc' => __('Re-Save permalink when you enable this option, please have a look <a href="https://ampforwp.com/flush-rewrite-urls/">here</a> on how to do it', 'accelerated-mobile-pages'),
2482
+ ),
2483
+ array(
2484
+ 'id' => 'fb-instant-article-feed-url',
2485
+ 'type' => 'info',
2486
+ 'style' => 'critical',
2487
+ 'desc' => fb_instant_article(),
2488
+ 'title' => __('Facebook Instant Articles Feed URL', 'accelerated-mobile-pages'),
2489
+ 'required' => array('fb-instant-article-switch', '=', 1)
2490
+ ),
2491
+
2492
+ ),
2493
+ )
2494
+ );
2495
+
2496
 
2497
  // Extension Section
2498
  Redux::setSection( $opt_name, array(
includes/redirect.php CHANGED
@@ -22,6 +22,10 @@ function ampforwp_page_template_redirect() {
22
 
23
  if($redux_builder_amp['amp-mobile-redirection']){
24
 
 
 
 
 
25
  if($post_type == 'forum'){
26
  return;
27
  }
22
 
23
  if($redux_builder_amp['amp-mobile-redirection']){
24
 
25
+ if( ampforwp_meta_redirection_status()=='disable' ){
26
+ return;
27
+ }
28
+
29
  if($post_type == 'forum'){
30
  return;
31
  }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === AMP for WP - Accelerated Mobile Pages ===
2
  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.53
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -82,6 +82,7 @@ Bug reports for AMP for WP are [welcomed on GitHub](https://github.com/ahmedkalu
82
  * Incontent & DoubleClick Support
83
  * Great Support & Active Development.
84
  * Widgets & WooCommerce
 
85
 
86
  **[JOIN CHAT GROUP COMMUNITY](http://ampforwp.com/community/)**: Purpose of this group is to get proper suggestions and feedback from plugin users and the community so that we can make the plugin even better.
87
 
@@ -135,6 +136,17 @@ You can contact me using this url: http://ampforwp.com/contact/
135
 
136
  == Changelog ==
137
 
 
 
 
 
 
 
 
 
 
 
 
138
  = 0.9.53 (19th June 2017) =
139
  * View more details on https://ampforwp.com/stability-validation-issues-59th-update/
140
  * Compatibility Issue with Rocket Lazy Load plugin #907
1
  === AMP for WP - Accelerated Mobile Pages ===
2
  Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
+ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO, Instant Articles
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.54
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
82
  * Incontent & DoubleClick Support
83
  * Great Support & Active Development.
84
  * Widgets & WooCommerce
85
+ * NEW - Facebook Instant Articles Support Added
86
 
87
  **[JOIN CHAT GROUP COMMUNITY](http://ampforwp.com/community/)**: Purpose of this group is to get proper suggestions and feedback from plugin users and the community so that we can make the plugin even better.
88
 
136
 
137
  == Changelog ==
138
 
139
+ = 0.9.54 (4th July 2017) =
140
+ * View more details on https://ampforwp.com/new/
141
+ * Facebook Instant Articles Support #862
142
+ * Exclude Some Pages from Mobile Redirection #914
143
+ * After 0.9.53 update amp-social-share js missing (critical issue) #924
144
+ * Hooks added in Header (above and below)
145
+ * View non AMP[Code improvement] #928
146
+ * Pages are not supposed to show meta like this, especially Categories #894
147
+ * Monarch plugin having design issues #925
148
+ * Show AMP Hide AMP Check Box Fixes #794
149
+
150
  = 0.9.53 (19th June 2017) =
151
  * View more details on https://ampforwp.com/stability-validation-issues-59th-update/
152
  * Compatibility Issue with Rocket Lazy Load plugin #907
templates/design-manager/design-1/elements/meta-info.php CHANGED
@@ -1,23 +1,28 @@
1
  <?php do_action('ampforwp_before_meta_info_hook',$this); ?>
2
- <div class="amp-wp-article-header ampforwp-meta-info">
 
3
 
4
  <?php $post_author = $this->get( 'post_author' ); ?>
5
  <?php
6
  if ( $post_author ) : ?>
7
  <div class="amp-wp-meta amp-wp-byline">
8
- <?php
9
  $author_image = get_avatar_url( $post_author->user_email, array( 'size' => 24 ) );
10
- if ( function_exists( 'get_avatar_url' ) && ( $author_image ) ) { ?>
 
11
  <amp-img src="<?php echo esc_url($author_image); ?>" width="24" height="24" layout="fixed"></amp-img>
12
- <?php }?>
13
-
14
- <span class="amp-wp-author author vcard"><?php echo esc_html( $post_author->display_name ); ?></span>
 
 
 
15
  </div>
16
  <?php endif; ?>
17
 
18
  <div class="amp-wp-meta amp-wp-posted-on">
19
  <time datetime="<?php echo esc_attr( date( 'c', $this->get( 'post_modified_timestamp' ) ) ); ?>">
20
- <?php
21
  global $redux_builder_amp;
22
  echo esc_html(
23
  sprintf(
@@ -25,7 +30,15 @@
25
  human_time_diff( $this->get( 'post_publish_timestamp' ), current_time( 'timestamp' ) )
26
  )
27
  );
28
- ?>
 
 
 
 
 
 
 
 
29
  </time>
30
  </div>
31
 
1
  <?php do_action('ampforwp_before_meta_info_hook',$this); ?>
2
+ <?php global $redux_builder_amp; ?>
3
+ <div class="amp-wp-article-header ampforwp-meta-info <?php if( is_page() && ! $redux_builder_amp['meta_page'] ) {?> hide-meta-info <?php }?>">
4
 
5
  <?php $post_author = $this->get( 'post_author' ); ?>
6
  <?php
7
  if ( $post_author ) : ?>
8
  <div class="amp-wp-meta amp-wp-byline">
9
+ <?php
10
  $author_image = get_avatar_url( $post_author->user_email, array( 'size' => 24 ) );
11
+ if ( function_exists( 'get_avatar_url' ) && ( $author_image ) ) {
12
+ if( is_single()) { ?>
13
  <amp-img src="<?php echo esc_url($author_image); ?>" width="24" height="24" layout="fixed"></amp-img>
14
+ <span class="amp-wp-author author vcard"><?php echo esc_html( $post_author->display_name ); ?></span>
15
+ <?php }
16
+ if( is_page() && $redux_builder_amp['meta_page'] ) { ?>
17
+ <amp-img src="<?php echo esc_url($author_image); ?>" width="24" height="24" layout="fixed"></amp-img>
18
+ <span class="amp-wp-author author vcard"><?php echo esc_html( $post_author->display_name ); ?></span>
19
+ <?php } } ?>
20
  </div>
21
  <?php endif; ?>
22
 
23
  <div class="amp-wp-meta amp-wp-posted-on">
24
  <time datetime="<?php echo esc_attr( date( 'c', $this->get( 'post_modified_timestamp' ) ) ); ?>">
25
+ <?php if( is_single()) {
26
  global $redux_builder_amp;
27
  echo esc_html(
28
  sprintf(
30
  human_time_diff( $this->get( 'post_publish_timestamp' ), current_time( 'timestamp' ) )
31
  )
32
  );
33
+ }?>
34
+ <?php if( is_page() && $redux_builder_amp['meta_page'] ) {
35
+ echo esc_html(
36
+ sprintf(
37
+ _x( '%s '.ampforwp_translation( $redux_builder_amp['amp-translator-ago-date-text'],'ago' ), '%s = human-readable time difference', 'accelerated-mobile-pages' ),
38
+ human_time_diff( $this->get( 'post_publish_timestamp' ), current_time( 'timestamp' ) )
39
+ )
40
+ );
41
+ }?>
42
  </time>
43
  </div>
44
 
templates/design-manager/design-1/footer.php CHANGED
@@ -1,37 +1,6 @@
1
  <?php
2
  global $redux_builder_amp;
3
- wp_reset_postdata();
4
- global $post;
5
- $ampforwp_backto_nonamp = '';
6
- if ( is_home() ) {
7
- if($redux_builder_amp['amp-mobile-redirection']==1)
8
- $ampforwp_backto_nonamp = trailingslashit(home_url()).'?nonamp=1' ;
9
- else
10
- $ampforwp_backto_nonamp = trailingslashit(home_url()) ;
11
- }
12
- if ( is_single() ){
13
- if($redux_builder_amp['amp-mobile-redirection']==1)
14
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1' ;
15
- else
16
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )) ;
17
- }
18
- if ( is_page() ){
19
- if($redux_builder_amp['amp-mobile-redirection']==1)
20
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1';
21
- else
22
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID ));
23
- }
24
- if( is_archive() ) {
25
- global $wp;
26
- if($redux_builder_amp['amp-mobile-redirection']==1){
27
- $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )).'?nonamp=1' );
28
- $ampforwp_backto_nonamp = preg_replace('/\/amp\?nonamp=1/','/?nonamp=1',$ampforwp_backto_nonamp);
29
- }
30
- else{
31
- $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )) );
32
- $ampforwp_backto_nonamp = preg_replace('/amp/','',$ampforwp_backto_nonamp);
33
- }
34
- } ?>
35
  <footer class="amp-wp-footer">
36
  <div id="footer">
37
  <?php if ( has_nav_menu( 'amp-footer-menu' ) ) { ?>
@@ -51,19 +20,14 @@ global $post;
51
  ?>
52
  </p>
53
 
54
- <p class="back-to-top">
55
- <a href="#top"> <?php echo ampforwp_translation( $redux_builder_amp['amp-translator-top-text'], 'Top' ); ?>
56
- </a>
57
- <?php
58
- //24. Added an options button for switching on/off link to non amp page
59
- if($redux_builder_amp['amp-footer-link-non-amp-page']=='1'){
60
- if ( $ampforwp_backto_nonamp ) { ?>
61
- |
62
- <a href="<?php echo $ampforwp_backto_nonamp; ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-non-amp-page-text'], 'View Non-AMP Version' ) ;?>
63
- </a> <?php
64
- }//End of inner condition
65
- }//End of outer condition?>
66
- </p>
67
  </div>
68
  </footer>
69
  <?php do_action('ampforwp_global_after_footer'); ?>
1
  <?php
2
  global $redux_builder_amp;
3
+ wp_reset_postdata(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  <footer class="amp-wp-footer">
5
  <div id="footer">
6
  <?php if ( has_nav_menu( 'amp-footer-menu' ) ) { ?>
20
  ?>
21
  </p>
22
 
23
+
24
+ <p class="back-to-top">
25
+ <a href="#top"> <?php echo ampforwp_translation( $redux_builder_amp['amp-translator-top-text'], 'Top' ); ?>
26
+ </a> <?php
27
+ if($redux_builder_amp['amp-footer-link-non-amp-page']=='1') { ?> | <?php ampforwp_view_nonamp();
28
+ } ?>
29
+ </p>
30
+
 
 
 
 
 
31
  </div>
32
  </footer>
33
  <?php do_action('ampforwp_global_after_footer'); ?>
templates/design-manager/design-1/header-bar.php CHANGED
@@ -2,6 +2,7 @@
2
  <header id="#top" class="amp-wp-header">
3
  <div class="ampforwp-logo-area" >
4
  <?php
 
5
  if( $redux_builder_amp['amp-on-off-support-for-non-amp-home-page'] ) {
6
  if( $redux_builder_amp['amp-mobile-redirection'] ) { ?>
7
  <a href="<?php echo esc_url( trailingslashit( $this->get( 'home_url' ) ).'?nonamp=1'); ?>" rel="nofollow">
@@ -65,7 +66,8 @@
65
  </a>
66
  </div>
67
  <?php do_action('ampforwp_header_search'); ?>
68
- <?php do_action('ampforwp_call_button'); ?>
 
69
 
70
 
71
 
2
  <header id="#top" class="amp-wp-header">
3
  <div class="ampforwp-logo-area" >
4
  <?php
5
+ do_action('ampforwp_header_top_design1');
6
  if( $redux_builder_amp['amp-on-off-support-for-non-amp-home-page'] ) {
7
  if( $redux_builder_amp['amp-mobile-redirection'] ) { ?>
8
  <a href="<?php echo esc_url( trailingslashit( $this->get( 'home_url' ) ).'?nonamp=1'); ?>" rel="nofollow">
66
  </a>
67
  </div>
68
  <?php do_action('ampforwp_header_search'); ?>
69
+ <?php do_action('ampforwp_call_button');
70
+ do_action('ampforwp_header_bottom_design1'); ?>
71
 
72
 
73
 
templates/design-manager/design-1/style.php CHANGED
@@ -26,7 +26,7 @@ blockquote {color: <?php echo sanitize_hex_color( $text_color ); ?>;background:
26
  .amp-wp-header {background-color: <?php echo sanitize_hex_color( $header_background_color ); ?>;}
27
  .amp-wp-header .ampforwp-logo-area {color: <?php echo sanitize_hex_color( $header_color ); ?>;font-size: 1em;font-weight: 400;margin: 0 auto;max-width: calc(840px - 32px);padding: .875em 16px;position: relative;} .amp-wp-header .amp-wp-site-icon {background-color: <?php echo sanitize_hex_color( $header_color ); ?>;border: 1px solid <?php echo sanitize_hex_color( $header_color ); ?>;border-radius: 50%;position: absolute;right: 18px;top: 10px;}
28
  .amp-wp-article {color: <?php echo sanitize_hex_color( $text_color ); ?>;font-weight: 400;margin: 1.5em auto;max-width: 840px;overflow-wrap: break-word;word-wrap: break-word;} .amp-wp-article-header {align-items: center;align-content: stretch;display: flex;flex-wrap: wrap;justify-content: space-between;margin: 1.5em 16px 1.5em;}
29
- .amp-wp-title {color: <?php echo sanitize_hex_color( $text_color ); ?>;display: block;flex: 1 0 100%;font-weight: 900;margin: 0;width: 100%;}.amp-wp-meta {color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;display: inline-block;flex: 2 1 50%;font-size: .875em;line-height: 1.7em;margin: 0;padding: 0;}.ampforwp-meta-info{margin-top: 0px;}.amp-wp-article-header .amp-wp-meta:last-of-type {text-align: right;}.amp-wp-article-header .amp-wp-meta:first-of-type {text-align: left;}.amp-wp-byline amp-img,.amp-wp-byline .amp-wp-author {display: inline-block;vertical-align: middle;}.amp-wp-byline amp-img {border: 1px solid <?php echo sanitize_hex_color( $link_color ); ?>;border-radius: 50%;position: relative;margin-right: 6px;}.amp-wp-posted-on {text-align: right;}
30
  .amp-wp-article-featured-image {margin: 1.5em 16px 1.5em;}.amp-wp-article-featured-image amp-img {margin: 0 auto;}.amp-wp-article-featured-image.wp-caption .wp-caption-text {margin: 0 18px;}.amp-wp-frontpage .the_content {padding: 10px;}.amp-wp-frontpage .ampforwp-title {margin-left:10px;}.amp-wp-article a{text-decoration:none}.amp-wp-article-content {margin: 0 16px;}.amp-wp-article-content ul,.amp-wp-article-content ol {margin-left: 1em;}.amp-wp-article-content amp-img {margin: 0 auto;}.amp-wp-article-content amp-img.alignright {margin: 0 0 1em 16px;}.amp-wp-article-content amp-img.alignleft {margin: 0 16px 1em 0;} .amp-disqus-comments {padding: 15px;}.amp-disqus-comments amp-iframe{background: none;}.wp-caption {padding: 0;}.wp-caption.alignleft {margin-right: 16px;}.wp-caption.alignright { margin-left: 16px;}.wp-caption-text {border-bottom: 1px solid <?php echo sanitize_hex_color( $border_color ); ?>;color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .875em;line-height: 1.5em;margin: 0;padding: .66em 10px .75em;text-align: center;} amp-carousel {background: <?php echo sanitize_hex_color( $border_color ); ?>;margin: 0 -16px 1.5em;} amp-iframe,amp-youtube,amp-instagram,amp-vine {background: <?php echo sanitize_hex_color( $border_color ); ?>;margin: 0 -16px 1.5em; } .amp-wp-article-content amp-carousel amp-img {border: none;} amp-carousel > amp-img > img {object-fit: contain; } .amp-wp-iframe-placeholder { background: <?php echo sanitize_hex_color( $border_color ); ?> url( <?php echo esc_url( $get_customizer->get( 'placeholder_image_url' ) ); ?> ) no-repeat center 40%;background-size: 48px 48px;min-height: 48px;} .amp-wp-article-footer .amp-wp-meta {display: block;} .amp-wp-tax-category span{margin-right:5px;} .amp-wp-tax-category, .amp-wp-tax-tag { color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .875em;line-height: 1.5em;margin: 1.5em 16px;}.ampforwp-comment-button {margin-bottom:20px;} .amp-wp-comments-link {color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .875em;line-height: 1.5em;text-align: center;margin: 2.25em 0 1.5em;} .amp-wp-comments-link a { border-style: solid;border-color: <?php echo sanitize_hex_color( $border_color ); ?>;border-width: 1px 1px 2px;border-radius: 4px;background-color: transparent;color: <?php echo sanitize_hex_color( $link_color ); ?>;cursor: pointer; display: block;font-size: 14px;font-weight: 600;line-height: 18px;margin: 0 auto;max-width: 200px;padding: 11px 16px;text-decoration: none;width: 50%;-webkit-transition: background-color 0.2s ease;transition: background-color 0.2s ease;} .page-title {margin: 0 15px;} .amp-wp-footer {border-top: 1px solid <?php echo sanitize_hex_color( $border_color ); ?>;margin: calc(1.5em - 1px) 0 0;padding-bottom:25px;}
31
  .amp-wp-footer div{margin:0 auto;max-width:calc(840px - 32px);padding:1.25em 16px;position:relative}.amp-wp-footer h2{font-size:1em;line-height:1.375em;margin:0 0 .5em}
32
  .amp-wp-footer p {color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .8em;line-height: 1.5em;margin: 0 15px 0 0;}
26
  .amp-wp-header {background-color: <?php echo sanitize_hex_color( $header_background_color ); ?>;}
27
  .amp-wp-header .ampforwp-logo-area {color: <?php echo sanitize_hex_color( $header_color ); ?>;font-size: 1em;font-weight: 400;margin: 0 auto;max-width: calc(840px - 32px);padding: .875em 16px;position: relative;} .amp-wp-header .amp-wp-site-icon {background-color: <?php echo sanitize_hex_color( $header_color ); ?>;border: 1px solid <?php echo sanitize_hex_color( $header_color ); ?>;border-radius: 50%;position: absolute;right: 18px;top: 10px;}
28
  .amp-wp-article {color: <?php echo sanitize_hex_color( $text_color ); ?>;font-weight: 400;margin: 1.5em auto;max-width: 840px;overflow-wrap: break-word;word-wrap: break-word;} .amp-wp-article-header {align-items: center;align-content: stretch;display: flex;flex-wrap: wrap;justify-content: space-between;margin: 1.5em 16px 1.5em;}
29
+ .amp-wp-title {color: <?php echo sanitize_hex_color( $text_color ); ?>;display: block;flex: 1 0 100%;font-weight: 900;margin: 0;width: 100%;}.amp-wp-meta {color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;display: inline-block;flex: 2 1 50%;font-size: .875em;line-height: 1.7em;margin: 0;padding: 0;}.ampforwp-meta-info{margin-top: 0px;}.amp-wp-article-header .amp-wp-meta:last-of-type {text-align: right;}.amp-wp-article-header .amp-wp-meta:first-of-type {text-align: left;}.amp-wp-byline amp-img,.amp-wp-byline .amp-wp-author {display: inline-block;vertical-align: middle;}.amp-wp-byline amp-img {border: 1px solid <?php echo sanitize_hex_color( $link_color ); ?>;border-radius: 50%;position: relative;margin-right: 6px;}.amp-wp-posted-on {text-align: right;}.hide-meta-info{ display: none; }
30
  .amp-wp-article-featured-image {margin: 1.5em 16px 1.5em;}.amp-wp-article-featured-image amp-img {margin: 0 auto;}.amp-wp-article-featured-image.wp-caption .wp-caption-text {margin: 0 18px;}.amp-wp-frontpage .the_content {padding: 10px;}.amp-wp-frontpage .ampforwp-title {margin-left:10px;}.amp-wp-article a{text-decoration:none}.amp-wp-article-content {margin: 0 16px;}.amp-wp-article-content ul,.amp-wp-article-content ol {margin-left: 1em;}.amp-wp-article-content amp-img {margin: 0 auto;}.amp-wp-article-content amp-img.alignright {margin: 0 0 1em 16px;}.amp-wp-article-content amp-img.alignleft {margin: 0 16px 1em 0;} .amp-disqus-comments {padding: 15px;}.amp-disqus-comments amp-iframe{background: none;}.wp-caption {padding: 0;}.wp-caption.alignleft {margin-right: 16px;}.wp-caption.alignright { margin-left: 16px;}.wp-caption-text {border-bottom: 1px solid <?php echo sanitize_hex_color( $border_color ); ?>;color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .875em;line-height: 1.5em;margin: 0;padding: .66em 10px .75em;text-align: center;} amp-carousel {background: <?php echo sanitize_hex_color( $border_color ); ?>;margin: 0 -16px 1.5em;} amp-iframe,amp-youtube,amp-instagram,amp-vine {background: <?php echo sanitize_hex_color( $border_color ); ?>;margin: 0 -16px 1.5em; } .amp-wp-article-content amp-carousel amp-img {border: none;} amp-carousel > amp-img > img {object-fit: contain; } .amp-wp-iframe-placeholder { background: <?php echo sanitize_hex_color( $border_color ); ?> url( <?php echo esc_url( $get_customizer->get( 'placeholder_image_url' ) ); ?> ) no-repeat center 40%;background-size: 48px 48px;min-height: 48px;} .amp-wp-article-footer .amp-wp-meta {display: block;} .amp-wp-tax-category span{margin-right:5px;} .amp-wp-tax-category, .amp-wp-tax-tag { color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .875em;line-height: 1.5em;margin: 1.5em 16px;}.ampforwp-comment-button {margin-bottom:20px;} .amp-wp-comments-link {color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .875em;line-height: 1.5em;text-align: center;margin: 2.25em 0 1.5em;} .amp-wp-comments-link a { border-style: solid;border-color: <?php echo sanitize_hex_color( $border_color ); ?>;border-width: 1px 1px 2px;border-radius: 4px;background-color: transparent;color: <?php echo sanitize_hex_color( $link_color ); ?>;cursor: pointer; display: block;font-size: 14px;font-weight: 600;line-height: 18px;margin: 0 auto;max-width: 200px;padding: 11px 16px;text-decoration: none;width: 50%;-webkit-transition: background-color 0.2s ease;transition: background-color 0.2s ease;} .page-title {margin: 0 15px;} .amp-wp-footer {border-top: 1px solid <?php echo sanitize_hex_color( $border_color ); ?>;margin: calc(1.5em - 1px) 0 0;padding-bottom:25px;}
31
  .amp-wp-footer div{margin:0 auto;max-width:calc(840px - 32px);padding:1.25em 16px;position:relative}.amp-wp-footer h2{font-size:1em;line-height:1.375em;margin:0 0 .5em}
32
  .amp-wp-footer p {color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .8em;line-height: 1.5em;margin: 0 15px 0 0;}
templates/design-manager/design-2/elements/meta-info.php CHANGED
@@ -1,5 +1,6 @@
1
- <?php do_action('ampforwp_before_meta_info_hook',$this); ?>
2
- <div class="amp-wp-article-header ampforwp-meta-info">
 
3
  <div class="amp-wp-content post-title-meta">
4
 
5
  <ul class="amp-wp-meta amp-meta-wrapper">
@@ -9,11 +10,15 @@
9
  <div class="amp-wp-meta amp-wp-byline">
10
  <?php if ( function_exists( 'get_avatar_url' ) && $author_avatar_url ) : ?>
11
  <amp-img src="<?php echo esc_url( $author_avatar_url ); ?>" width="24" height="24" layout="fixed"></amp-img>
12
- <?php endif; ?>
 
13
  <span class="amp-wp-author author vcard"><?php echo esc_html( $post_author->display_name ); ?></span>
14
-
15
  <li class="amp-wp-meta-date"> <?php global $redux_builder_amp; echo ampforwp_translation($redux_builder_amp['amp-translator-on-text'] . ' ', 'On'); the_modified_date( get_option( 'date_format' ) ) ?></li>
16
-
 
 
 
 
17
  </div>
18
  <?php endif; ?>
19
 
1
+ <?php do_action('ampforwp_before_meta_info_hook',$this);
2
+ global $redux_builder_amp; ?>
3
+ <div class="amp-wp-article-header ampforwp-meta-info <?php if( is_page() && ! $redux_builder_amp['meta_page'] ) {?> hide-meta-info <?php }?>">
4
  <div class="amp-wp-content post-title-meta">
5
 
6
  <ul class="amp-wp-meta amp-meta-wrapper">
10
  <div class="amp-wp-meta amp-wp-byline">
11
  <?php if ( function_exists( 'get_avatar_url' ) && $author_avatar_url ) : ?>
12
  <amp-img src="<?php echo esc_url( $author_avatar_url ); ?>" width="24" height="24" layout="fixed"></amp-img>
13
+ <?php endif ;
14
+ if(is_single() ) {?>
15
  <span class="amp-wp-author author vcard"><?php echo esc_html( $post_author->display_name ); ?></span>
 
16
  <li class="amp-wp-meta-date"> <?php global $redux_builder_amp; echo ampforwp_translation($redux_builder_amp['amp-translator-on-text'] . ' ', 'On'); the_modified_date( get_option( 'date_format' ) ) ?></li>
17
+ <?php }
18
+ if( is_page() && $redux_builder_amp['meta_page'] ) { ?>
19
+ <span class="amp-wp-author author vcard"><?php echo esc_html( $post_author->display_name ); ?></span>
20
+ <li class="amp-wp-meta-date"> <?php global $redux_builder_amp; echo ampforwp_translation($redux_builder_amp['amp-translator-on-text'] . ' ', 'On'); the_modified_date( get_option( 'date_format' ) ) ?></li>
21
+ <?php } ?>
22
  </div>
23
  <?php endif; ?>
24
 
templates/design-manager/design-2/footer.php CHANGED
@@ -1,37 +1,5 @@
1
  <?php global $redux_builder_amp;
2
- wp_reset_postdata();
3
- global $post;
4
- $ampforwp_backto_nonamp = '';
5
- if ( is_home() ) {
6
- if($redux_builder_amp['amp-mobile-redirection']==1)
7
- $ampforwp_backto_nonamp = trailingslashit(home_url()).'?nonamp=1' ;
8
- else
9
- $ampforwp_backto_nonamp = trailingslashit(home_url()) ;
10
- }
11
- if ( is_single() ){
12
- if($redux_builder_amp['amp-mobile-redirection']==1)
13
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1' ;
14
- else
15
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )) ;
16
- }
17
- if ( is_page() ){
18
- if($redux_builder_amp['amp-mobile-redirection']==1)
19
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1';
20
- else
21
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID ));
22
- }
23
- if( is_archive() ) {
24
- global $wp;
25
- if($redux_builder_amp['amp-mobile-redirection']==1){
26
- $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )).'?nonamp=1' );
27
- $ampforwp_backto_nonamp = preg_replace('/\/amp\?nonamp=1/','/?nonamp=1',$ampforwp_backto_nonamp);
28
- }
29
- else{
30
- $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )) );
31
- $ampforwp_backto_nonamp = preg_replace('/amp/','',$ampforwp_backto_nonamp);
32
- }
33
- }
34
- ?>
35
  <footer class="container">
36
  <div id="footer">
37
  <?php if ( has_nav_menu( 'amp-footer-menu' ) ) { ?>
@@ -43,18 +11,18 @@
43
  echo strip_tags( $menu , '<ul><li><a>'); ?>
44
  </div>
45
  <?php } ?>
46
- <p><a href="#header"> <?php echo ampforwp_translation( $redux_builder_amp['amp-translator-top-text'], 'Top'); ?></a> <?php
47
- //24. Added an options button for switching on/off link to non amp page
48
- if($redux_builder_amp['amp-footer-link-non-amp-page']=='1') {
49
- if ( $ampforwp_backto_nonamp ) { ?> | <a href="<?php echo $ampforwp_backto_nonamp; ?>" rel="nofollow"><?php echo esc_html( $redux_builder_amp['amp-translator-non-amp-page-text'] ) ;?> </a> <?php }
50
- } ?>
51
- </p>
52
- <p>
53
  <?php
54
  global $allowed_html;
55
  echo wp_kses( ampforwp_translation($redux_builder_amp['amp-translator-footer-text'], 'Footer'),$allowed_html);
56
  ?>
57
- </p>
58
  </div>
59
  </footer>
60
  <?php do_action('ampforwp_global_after_footer'); ?>
1
  <?php global $redux_builder_amp;
2
+ wp_reset_postdata();?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  <footer class="container">
4
  <div id="footer">
5
  <?php if ( has_nav_menu( 'amp-footer-menu' ) ) { ?>
11
  echo strip_tags( $menu , '<ul><li><a>'); ?>
12
  </div>
13
  <?php } ?>
14
+
15
+ <p>
16
+ <a href="#header">
17
+ <?php echo ampforwp_translation( $redux_builder_amp['amp-translator-top-text'], 'Top'); ?> </a> <?php
18
+ if($redux_builder_amp['amp-footer-link-non-amp-page']=='1') { ?> | <?php ampforwp_view_nonamp();
19
+ } ?>
20
+
21
  <?php
22
  global $allowed_html;
23
  echo wp_kses( ampforwp_translation($redux_builder_amp['amp-translator-footer-text'], 'Footer'),$allowed_html);
24
  ?>
25
+ </p>
26
  </div>
27
  </footer>
28
  <?php do_action('ampforwp_global_after_footer'); ?>
templates/design-manager/design-2/header-bar.php CHANGED
@@ -1,8 +1,8 @@
1
  <header class="container">
2
  <div id="headerwrap">
3
  <div id="header">
4
-
5
- <?php global $redux_builder_amp;
6
  $set_rel_to_noamp=false;
7
 
8
  if( $redux_builder_amp['amp-on-off-support-for-non-amp-home-page'] ) {
@@ -26,6 +26,7 @@
26
  }?>
27
 
28
  <?php
 
29
  if (! empty( $redux_builder_amp['opt-media']['url'] ) ) { ?>
30
  <a href="<?php echo esc_url( $ampforwp_home_url ); ?>" <?php if($set_rel_to_noamp){echo ' rel="nofollow"'; } ?> >
31
 
@@ -44,7 +45,8 @@
44
  <h3><a href="<?php echo esc_url( $ampforwp_home_url ); ?>" <?php if($set_rel_to_noamp){echo ' rel="nofollow"';} ?> ><?php bloginfo('name'); ?></a></h3>
45
  <?php } ?>
46
  <?php do_action('ampforwp_header_search'); ?>
47
- <?php do_action('ampforwp_call_button'); ?>
 
48
  </div>
49
  </div>
50
  </header>
1
  <header class="container">
2
  <div id="headerwrap">
3
  <div id="header">
4
+ <?php
5
+ global $redux_builder_amp;
6
  $set_rel_to_noamp=false;
7
 
8
  if( $redux_builder_amp['amp-on-off-support-for-non-amp-home-page'] ) {
26
  }?>
27
 
28
  <?php
29
+ do_action('ampforwp_header_top_design2');
30
  if (! empty( $redux_builder_amp['opt-media']['url'] ) ) { ?>
31
  <a href="<?php echo esc_url( $ampforwp_home_url ); ?>" <?php if($set_rel_to_noamp){echo ' rel="nofollow"'; } ?> >
32
 
45
  <h3><a href="<?php echo esc_url( $ampforwp_home_url ); ?>" <?php if($set_rel_to_noamp){echo ' rel="nofollow"';} ?> ><?php bloginfo('name'); ?></a></h3>
46
  <?php } ?>
47
  <?php do_action('ampforwp_header_search'); ?>
48
+ <?php do_action('ampforwp_call_button');
49
+ do_action('ampforwp_header_bottom_design2'); ?>
50
  </div>
51
  </div>
52
  </header>
templates/design-manager/design-2/style.php CHANGED
@@ -210,7 +210,7 @@ table tr:last-child td {border-bottom: 0;}
210
  table tr:last-child td:first-child { -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; }
211
  table tr:last-child td:last-child { -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
212
  table tr:hover td { background: #f2f2f2; background: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#f0f0f0)); background: -moz-linear-gradient(top, #f2f2f2, #f0f0f0); }
213
-
214
  /* Responsive */
215
  @media screen and (min-width: 650px) { table {display: inline-table;} }
216
  @media screen and (max-width: 800px) { .single-post main{ padding: 12px 10px 10px 10px } }
210
  table tr:last-child td:first-child { -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; }
211
  table tr:last-child td:last-child { -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
212
  table tr:hover td { background: #f2f2f2; background: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#f0f0f0)); background: -moz-linear-gradient(top, #f2f2f2, #f0f0f0); }
213
+ .hide-meta-info{ display: none; }
214
  /* Responsive */
215
  @media screen and (min-width: 650px) { table {display: inline-table;} }
216
  @media screen and (max-width: 800px) { .single-post main{ padding: 12px 10px 10px 10px } }
templates/design-manager/design-3/elements/meta-info.php CHANGED
@@ -1,6 +1,6 @@
1
- <?php global $redux_builder_amp; ?>
2
- <?php do_action('ampforwp_before_meta_info_hook',$this); ?>
3
 
 
 
4
  <div class="amp-wp-content amp-wp-article-header ampforwp-meta-info">
5
  <div class="amp-wp-content post-title-meta">
6
 
@@ -8,8 +8,12 @@
8
  <?php $post_author = $this->get( 'post_author' ); ?>
9
  <?php if ( $post_author ) : ?>
10
  <div class="amp-wp-meta amp-wp-byline">
 
11
  <span class="amp-wp-author author vcard"><?php echo esc_html( $post_author->display_name ); ?></span>
12
-
 
 
 
13
  <?php $ampforwp_categories = get_the_terms( $this->ID, 'category' );
14
  if ( $ampforwp_categories ) : ?>
15
  <span class="amp-wp-meta amp-wp-tax-category ampforwp-tax-category ">
 
 
1
 
2
+ <?php do_action('ampforwp_before_meta_info_hook',$this); ?>
3
+ <?php global $redux_builder_amp; ?>
4
  <div class="amp-wp-content amp-wp-article-header ampforwp-meta-info">
5
  <div class="amp-wp-content post-title-meta">
6
 
8
  <?php $post_author = $this->get( 'post_author' ); ?>
9
  <?php if ( $post_author ) : ?>
10
  <div class="amp-wp-meta amp-wp-byline">
11
+ <?php if ( is_single() ) { ?>
12
  <span class="amp-wp-author author vcard"><?php echo esc_html( $post_author->display_name ); ?></span>
13
+ <?php } ?>
14
+ <?php if( is_page() && $redux_builder_amp['meta_page'] ) { ?>
15
+ <span class="amp-wp-author author vcard"><?php echo esc_html( $post_author->display_name ); ?></span>
16
+ <?php } ?>
17
  <?php $ampforwp_categories = get_the_terms( $this->ID, 'category' );
18
  if ( $ampforwp_categories ) : ?>
19
  <span class="amp-wp-meta amp-wp-tax-category ampforwp-tax-category ">
templates/design-manager/design-3/footer.php CHANGED
@@ -1,38 +1,5 @@
1
  <?php global $redux_builder_amp;
2
- wp_reset_postdata();
3
- global $post;
4
- $ampforwp_backto_nonamp = '';
5
- if ( is_home() ) {
6
- if($redux_builder_amp['amp-mobile-redirection']==1)
7
- $ampforwp_backto_nonamp = trailingslashit(home_url()).'?nonamp=1' ;
8
- else
9
- $ampforwp_backto_nonamp = trailingslashit(home_url()) ;
10
- }
11
- if ( is_single() ){
12
- if($redux_builder_amp['amp-mobile-redirection']==1)
13
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1' ;
14
- else
15
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )) ;
16
- }
17
- if ( is_page() ){
18
- if($redux_builder_amp['amp-mobile-redirection']==1)
19
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1';
20
- else
21
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID ));
22
- }
23
- if( is_archive() ) {
24
- global $wp;
25
- if($redux_builder_amp['amp-mobile-redirection']==1){
26
- $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )).'?nonamp=1' );
27
- $ampforwp_backto_nonamp = preg_replace('/\/amp\?nonamp=1/','/?nonamp=1',$ampforwp_backto_nonamp);
28
- }
29
- else{
30
- $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )) );
31
- $ampforwp_backto_nonamp = preg_replace('/amp/','',$ampforwp_backto_nonamp);
32
- }
33
- }
34
- ?>
35
-
36
  <footer class="footer_wrapper container">
37
  <div id="footer">
38
  <?php if ( has_nav_menu( 'amp-footer-menu' ) ) { ?>
@@ -110,13 +77,8 @@
110
  <p class="rightslink">
111
  <?php
112
  global $allowed_html;
113
- echo wp_kses( ampforwp_translation($redux_builder_amp['amp-translator-footer-text'], 'Footer') ,$allowed_html) ;
114
- ?>
115
- <?php
116
- //24. Added an options button for switching on/off link to non amp page
117
- if($redux_builder_amp['amp-footer-link-non-amp-page']=='1') {
118
- if ( $ampforwp_backto_nonamp ) { ?> | <a href="<?php echo $ampforwp_backto_nonamp; ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-non-amp-page-text'], 'View Non-AMP Version' ) ;?> </a> <?php }
119
- } ?>
120
  </p>
121
  <?php global $redux_builder_amp; if( $redux_builder_amp['amp-design-3-credit-link'] ) { ?>
122
  <p class="poweredby">
1
  <?php global $redux_builder_amp;
2
+ wp_reset_postdata();?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  <footer class="footer_wrapper container">
4
  <div id="footer">
5
  <?php if ( has_nav_menu( 'amp-footer-menu' ) ) { ?>
77
  <p class="rightslink">
78
  <?php
79
  global $allowed_html;
80
+ echo wp_kses( ampforwp_translation($redux_builder_amp['amp-translator-footer-text'], 'Footer') ,$allowed_html ) ;
81
+ if($redux_builder_amp['amp-footer-link-non-amp-page']=='1') { ?> | <?php ampforwp_view_nonamp(); } ?>
 
 
 
 
 
82
  </p>
83
  <?php global $redux_builder_amp; if( $redux_builder_amp['amp-design-3-credit-link'] ) { ?>
84
  <p class="poweredby">
templates/design-manager/design-3/header-bar.php CHANGED
@@ -87,6 +87,7 @@
87
  </div>
88
  <div class="headerlogo">
89
  <?php global $redux_builder_amp;
 
90
  $set_rel_to_noamp=false;
91
 
92
  if( $redux_builder_amp['amp-on-off-support-for-non-amp-home-page'] ) {
@@ -128,7 +129,8 @@
128
  <?php } ?>
129
  </div>
130
  <?php do_action('ampforwp_call_button'); ?>
131
- <?php do_action('ampforwp_header_search'); ?>
 
132
 
133
  </div>
134
  </div>
87
  </div>
88
  <div class="headerlogo">
89
  <?php global $redux_builder_amp;
90
+ do_action('ampforwp_header_top_design3');
91
  $set_rel_to_noamp=false;
92
 
93
  if( $redux_builder_amp['amp-on-off-support-for-non-amp-home-page'] ) {
129
  <?php } ?>
130
  </div>
131
  <?php do_action('ampforwp_call_button'); ?>
132
+ <?php do_action('ampforwp_header_search');
133
+ do_action('ampforwp_header_bottom_design3'); ?>
134
 
135
  </div>
136
  </div>
templates/features.php CHANGED
@@ -1046,16 +1046,19 @@ define('AMPFORWP_COMMENTS_PER_PAGE', $redux_builder_amp['ampforwp-number-of-comm
1046
  /**
1047
  * Adds a meta box to the post editing screen for AMP on-off on specific pages
1048
  */
 
 
 
 
 
 
 
 
 
1049
  function ampforwp_title_custom_meta() {
1050
  global $redux_builder_amp;
1051
- $args = array(
1052
- 'public' => true,
1053
- );
1054
-
1055
- $output = 'names'; // 'names' or 'objects' (default: 'names')
1056
- $operator = 'and'; // 'and' or 'or' (default: 'and')
1057
 
1058
- $post_types = get_post_types( $args, $output, $operator );
1059
 
1060
  if ( $post_types ) { // If there are any custom public post types.
1061
 
@@ -1067,15 +1070,19 @@ function ampforwp_title_custom_meta() {
1067
 
1068
  if( $post_type !== 'page' ) {
1069
  add_meta_box( 'ampforwp_title_meta', __( 'Show AMP for Current Page?','accelerated-mobile-pages' ), 'ampforwp_title_callback', $post_type,'side' );
 
1070
  }
1071
 
1072
  if( $redux_builder_amp['amp-on-off-for-all-pages'] && $post_type == 'page' ) {
1073
  add_meta_box( 'ampforwp_title_meta', __( 'Show AMP for Current Page?' ,'accelerated-mobile-pages'), 'ampforwp_title_callback','page','side' );
 
 
 
1074
  }
1075
 
1076
  }
1077
  }
1078
- }
1079
  add_action( 'add_meta_boxes', 'ampforwp_title_custom_meta' );
1080
 
1081
  /**
@@ -1124,13 +1131,114 @@ function ampforwp_title_callback( $post ) {
1124
  </label>
1125
  </div>
1126
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1127
  <?php
1128
  }
1129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1130
  /**
1131
  * Saves the custom meta input for AMP on-off on specific pages
1132
  */
1133
  function ampforwp_title_meta_save( $post_id ) {
 
1134
 
1135
  // Checks save status
1136
  $is_autosave = wp_is_post_autosave( $post_id );
@@ -1148,6 +1256,11 @@ function ampforwp_title_meta_save( $post_id ) {
1148
  update_post_meta( $post_id, 'ampforwp-amp-on-off', $ampforwp_amp_status );
1149
  }
1150
 
 
 
 
 
 
1151
  }
1152
  add_action( 'save_post', 'ampforwp_title_meta_save' );
1153
 
@@ -1286,6 +1399,9 @@ function ampforwp_remove_schema_data() {
1286
  ampforwp_remove_filters_for_class( 'amp_post_template_head', 'Sassy_Social_Share_Public', 'frontend_scripts', 10 );
1287
  ampforwp_remove_filters_for_class( 'amp_post_template_css', 'Sassy_Social_Share_Public', 'frontend_inline_style', 10 );
1288
  ampforwp_remove_filters_for_class( 'amp_post_template_css', 'Sassy_Social_Share_Public', 'frontend_amp_css', 10 );
 
 
 
1289
  }
1290
  }
1291
 
@@ -2906,4 +3022,56 @@ function ampforwp_remove_sq_seo() {
2906
  if ( $ampforwp_sq_google_analytics && $ampforwp_sq_amp_analytics ) {
2907
  remove_action('amp_post_template_head','ampforwp_register_analytics_script', 20);
2908
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2909
  }
1046
  /**
1047
  * Adds a meta box to the post editing screen for AMP on-off on specific pages
1048
  */
1049
+ function ampforwp_get_all_post_types(){
1050
+ global $redux_builder_amp;
1051
+
1052
+ $post_types = array('post' => 'post', 'page' => 'page');
1053
+ if ( $redux_builder_amp['ampforwp-custom-type'] ) {
1054
+ $post_types = array_merge($post_types, $redux_builder_amp['ampforwp-custom-type']);
1055
+ }
1056
+ return $post_types;
1057
+ }
1058
  function ampforwp_title_custom_meta() {
1059
  global $redux_builder_amp;
 
 
 
 
 
 
1060
 
1061
+ $post_types = ampforwp_get_all_post_types();
1062
 
1063
  if ( $post_types ) { // If there are any custom public post types.
1064
 
1070
 
1071
  if( $post_type !== 'page' ) {
1072
  add_meta_box( 'ampforwp_title_meta', __( 'Show AMP for Current Page?','accelerated-mobile-pages' ), 'ampforwp_title_callback', $post_type,'side' );
1073
+
1074
  }
1075
 
1076
  if( $redux_builder_amp['amp-on-off-for-all-pages'] && $post_type == 'page' ) {
1077
  add_meta_box( 'ampforwp_title_meta', __( 'Show AMP for Current Page?' ,'accelerated-mobile-pages'), 'ampforwp_title_callback','page','side' );
1078
+ }
1079
+
1080
+
1081
  }
1082
 
1083
  }
1084
  }
1085
+
1086
  add_action( 'add_meta_boxes', 'ampforwp_title_custom_meta' );
1087
 
1088
  /**
1131
  </label>
1132
  </div>
1133
  </p>
1134
+
1135
+
1136
+
1137
+ <?php
1138
+ }
1139
+
1140
+ /**
1141
+ * Adds a meta box to the post editing screen for Mobile Redirection on-off on specific pages
1142
+ */
1143
+
1144
+ function ampforwp_mobile_redirection() {
1145
+ global $redux_builder_amp;
1146
+ $post_types = ampforwp_get_all_post_types();
1147
+
1148
+ if ( $post_types ) { // If there are any custom public post types.
1149
+
1150
+ foreach ( $post_types as $post_type ) {
1151
+
1152
+ if( $post_type == 'amp-cta' || $post_type == 'amp-optin' ) {
1153
+ continue;
1154
+ }
1155
+ if( $post_type !== 'page' ) {
1156
+ if ( $redux_builder_amp['amp-mobile-redirection'] ) {
1157
+ add_meta_box( 'ampforwp_title_meta_redir', __( 'Mobile Redirection for Current Page?','accelerated-mobile-pages' ), 'ampforwp_title_callback_redirection', $post_type,'side' );
1158
+ }
1159
+ }
1160
+
1161
+ if( $redux_builder_amp['amp-on-off-for-all-pages'] && $post_type == 'page' ) {
1162
+ if ( $redux_builder_amp['amp-mobile-redirection'] ) {
1163
+ add_meta_box( 'ampforwp_title_meta_redir', __( 'Mobile Redirection for Current Page?' ,'accelerated-mobile-pages'), 'ampforwp_title_callback_redirection','page','side' );
1164
+ }
1165
+ }
1166
+ }
1167
+
1168
+ }
1169
+ }
1170
+
1171
+ add_action( 'add_meta_boxes', 'ampforwp_mobile_redirection' );
1172
+
1173
+ /**
1174
+ * Outputs the content of the meta box for Mobile Redirection on-off on specific pages
1175
+ */
1176
+ function ampforwp_title_callback_redirection( $post ) {
1177
+ wp_nonce_field( basename( __FILE__ ), 'ampforwp_title_nonce' );
1178
+ $ampforwp_redirection_stored_meta = get_post_meta( $post->ID );
1179
+
1180
+ // 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()
1181
+ // This code needs a rewrite.
1182
+ if ( $ampforwp_redirection_stored_meta['ampforwp-redirection-on-off'][0] == 'disable') {
1183
+ $exclude_post_value = get_option('ampforwp_exclude_post');
1184
+ if ( $exclude_post_value == null ) {
1185
+ $exclude_post_value[] = 0;
1186
+ }
1187
+ if ( $exclude_post_value ) {
1188
+ if ( ! in_array( $post->ID, $exclude_post_value ) ) {
1189
+ $exclude_post_value[] = $post->ID;
1190
+ update_option('ampforwp_exclude_post', $exclude_post_value);
1191
+ }
1192
+ }
1193
+ } else {
1194
+ $exclude_post_value = get_option('ampforwp_exclude_post');
1195
+ if ( $exclude_post_value == null ) {
1196
+ $exclude_post_value[] = 0;
1197
+ }
1198
+ if ( $exclude_post_value ) {
1199
+ if ( in_array( $post->ID, $exclude_post_value ) ) {
1200
+ $exclude_ids = array_diff($exclude_post_value, array($post->ID) );
1201
+ update_option('ampforwp_exclude_post', $exclude_ids);
1202
+ }
1203
+ }
1204
+
1205
+ }
1206
+ ?>
1207
+ <p>
1208
+ <div class="prfx-row-content">
1209
+ <label for="meta-redirection-radio-one">
1210
+ <input type="radio" name="ampforwp-redirection-on-off" id="meta-redirection-radio-one" value="enable" checked="checked" <?php if ( isset ( $ampforwp_redirection_stored_meta['ampforwp-redirection-on-off'] ) ) checked( $ampforwp_redirection_stored_meta['ampforwp-redirection-on-off'][0], 'enable' ); ?>>
1211
+ <?php _e( 'Enable' )?>
1212
+ </label>
1213
+ <label for="meta-redirection-radio-two">
1214
+ <input type="radio" name="ampforwp-redirection-on-off" id="meta-redirection-radio-two" value="disable" <?php if ( isset ( $ampforwp_redirection_stored_meta['ampforwp-redirection-on-off'] ) ) checked( $ampforwp_redirection_stored_meta['ampforwp-redirection-on-off'][0], 'disable' ); ?>>
1215
+ <?php _e( 'Disable' )?>
1216
+ </label>
1217
+ </div>
1218
+ </p>
1219
+
1220
  <?php
1221
  }
1222
 
1223
+ function ampforwp_meta_redirection_status(){
1224
+ global $post;
1225
+ $ampforwp_redirection_post_on_off_meta = '';
1226
+
1227
+ $ampforwp_redirection_post_on_off_meta = get_post_meta( $post->ID,'ampforwp-redirection-on-off',true);
1228
+
1229
+ if ( empty( $ampforwp_redirection_post_on_off_meta ) ) {
1230
+ $ampforwp_redirection_post_on_off_meta = 'enable';
1231
+ }
1232
+
1233
+ return $ampforwp_redirection_post_on_off_meta;
1234
+
1235
+ }
1236
+
1237
  /**
1238
  * Saves the custom meta input for AMP on-off on specific pages
1239
  */
1240
  function ampforwp_title_meta_save( $post_id ) {
1241
+ $ampforwp_amp_status = '';
1242
 
1243
  // Checks save status
1244
  $is_autosave = wp_is_post_autosave( $post_id );
1256
  update_post_meta( $post_id, 'ampforwp-amp-on-off', $ampforwp_amp_status );
1257
  }
1258
 
1259
+ if( isset( $_POST[ 'ampforwp-redirection-on-off' ] ) ) {
1260
+ $ampforwp_redirection_status = sanitize_text_field( $_POST[ 'ampforwp-redirection-on-off' ] );
1261
+ update_post_meta( $post_id, 'ampforwp-redirection-on-off', $ampforwp_redirection_status );
1262
+ }
1263
+
1264
  }
1265
  add_action( 'save_post', 'ampforwp_title_meta_save' );
1266
 
1399
  ampforwp_remove_filters_for_class( 'amp_post_template_head', 'Sassy_Social_Share_Public', 'frontend_scripts', 10 );
1400
  ampforwp_remove_filters_for_class( 'amp_post_template_css', 'Sassy_Social_Share_Public', 'frontend_inline_style', 10 );
1401
  ampforwp_remove_filters_for_class( 'amp_post_template_css', 'Sassy_Social_Share_Public', 'frontend_amp_css', 10 );
1402
+ //Removing the Monarch social share icons from AMP
1403
+ ampforwp_remove_filters_for_class( 'the_content', 'ET_Monarch', 'display_inline', 10 );
1404
+ ampforwp_remove_filters_for_class( 'the_content', 'ET_Monarch', 'display_media', 9999 );
1405
  }
1406
  }
1407
 
3022
  if ( $ampforwp_sq_google_analytics && $ampforwp_sq_amp_analytics ) {
3023
  remove_action('amp_post_template_head','ampforwp_register_analytics_script', 20);
3024
  }
3025
+ }
3026
+
3027
+ //67 View Non AMP
3028
+ function ampforwp_view_nonamp(){
3029
+ global $redux_builder_amp;
3030
+ global $post;
3031
+ $ampforwp_backto_nonamp = '';
3032
+ if ( is_home() ) {
3033
+ if($redux_builder_amp['amp-mobile-redirection']==1)
3034
+ $ampforwp_backto_nonamp = trailingslashit(home_url()).'?nonamp=1' ;
3035
+ else
3036
+ $ampforwp_backto_nonamp = trailingslashit(home_url()) ;
3037
+ }
3038
+ if ( is_single() ){
3039
+ if($redux_builder_amp['amp-mobile-redirection']==1)
3040
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1' ;
3041
+ else
3042
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )) ;
3043
+ }
3044
+ if ( is_page() ){
3045
+ if($redux_builder_amp['amp-mobile-redirection']==1)
3046
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1';
3047
+ else
3048
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID ));
3049
+ }
3050
+ if( is_archive() ) {
3051
+ global $wp;
3052
+ if($redux_builder_amp['amp-mobile-redirection']==1){
3053
+ $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )).'?nonamp=1' );
3054
+ $ampforwp_backto_nonamp = preg_replace('/\/amp\?nonamp=1/','/?nonamp=1',$ampforwp_backto_nonamp);
3055
+ }
3056
+ else{
3057
+ $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )) );
3058
+ $ampforwp_backto_nonamp = preg_replace('/amp/','',$ampforwp_backto_nonamp);
3059
+ }
3060
+ } ?>
3061
+ <?php if ( $ampforwp_backto_nonamp ) { ?> <a href="<?php echo $ampforwp_backto_nonamp; ?>" rel="nofollow"><?php echo esc_html( $redux_builder_amp['amp-translator-non-amp-page-text'] ) ;?> </a> <?php }
3062
+ }
3063
+
3064
+ //68. Facebook Instant Articles
3065
+ add_action('init', 'fb_instant_article_feed_generator');
3066
+
3067
+ function fb_instant_article_feed_generator() {
3068
+ global $redux_builder_amp;
3069
+ if( $redux_builder_amp['fb-instant-article-switch'] ) {
3070
+ add_feed('instant_articles', 'fb_instant_article_feed_function');
3071
+ }
3072
+ }
3073
+
3074
+ function fb_instant_article_feed_function() {
3075
+ add_filter('pre_option_rss_use_excerpt', '__return_zero');
3076
+ load_template( AMPFORWP_PLUGIN_DIR . '/feeds/instant-article-feed.php' );
3077
  }
templates/frontpage-elements.php CHANGED
@@ -75,38 +75,7 @@ function ampforwp_design_1_frontpage_content( $template, $post_id ){
75
 
76
  <div class="amp-wp-content post-pagination-meta">
77
  <?php $template->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
78
- </div> <?php
79
-
80
-
81
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
82
- if( $redux_builder_amp['enable-single-social-icons'] == true && !is_plugin_active( 'amp-cta/amp-cta.php' ) ) { ?>
83
- <div class="sticky_social">
84
- <?php if($redux_builder_amp['enable-single-facebook-share'] == true) { ?>
85
- <amp-social-share type="facebook" width="50" height="28"></amp-social-share>
86
- <?php } ?>
87
- <?php if($redux_builder_amp['enable-single-twitter-share'] == true) {
88
- $data_param_data = $redux_builder_amp['enable-single-twitter-share-handle']; ?>
89
- <amp-social-share type="twitter"
90
- width="50"
91
- height="28"
92
- data-param-url=""
93
- data-param-text="TITLE <?php echo wp_get_shortlink().' '.ampforwp_translation( $redux_builder_amp['amp-translator-via-text'], 'via' ).' '.$data_param_data ?>"
94
- ></amp-social-share>
95
- <?php } ?>
96
- <?php if($redux_builder_amp['enable-single-gplus-share'] == true) { ?>
97
- <amp-social-share type="gplus" width="50" height="28"></amp-social-share>
98
- <?php } ?>
99
- <?php if($redux_builder_amp['enable-single-email-share'] == true) { ?>
100
- <amp-social-share type="email" width="50" height="28"></amp-social-share>
101
- <?php } ?>
102
- <?php if($redux_builder_amp['enable-single-pinterest-share'] == true) { ?>
103
- <amp-social-share type="pinterest" width="50" height="28"></amp-social-share>
104
- <?php } ?>
105
- <?php if($redux_builder_amp['enable-single-linkedin-share'] == true) { ?>
106
- <amp-social-share type="linkedin" width="50" height="28"></amp-social-share>
107
- <?php } ?>
108
- </div>
109
- <?php } ?>
110
  </article> <?php
111
  }
112
 
@@ -150,37 +119,7 @@ function ampforwp_design_2_frontpage_content($template, $post_id){
150
 
151
  <div class="amp-wp-content post-pagination-meta">
152
  <?php $template->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
153
- </div> <?php
154
-
155
-
156
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
157
- if( $redux_builder_amp['enable-single-social-icons'] == true && !is_plugin_active( 'amp-cta/amp-cta.php' ) ) { ?>
158
- <div class="sticky_social">
159
- <?php if($redux_builder_amp['enable-single-facebook-share'] == true) { ?>
160
- <amp-social-share type="facebook" width="50" height="28"></amp-social-share>
161
- <?php } ?>
162
- <?php if($redux_builder_amp['enable-single-twitter-share'] == true) { $data_param_data = $redux_builder_amp['enable-single-twitter-share-handle'];?>
163
- <amp-social-share type="twitter"
164
- width="50"
165
- height="28"
166
- data-param-url=""
167
- data-param-text="TITLE <?php echo wp_get_shortlink().' '.ampforwp_translation( $redux_builder_amp['amp-translator-via-text'], 'via' ).' '.$data_param_data ?>"
168
- ></amp-social-share>
169
- <?php } ?>
170
- <?php if($redux_builder_amp['enable-single-gplus-share'] == true) { ?>
171
- <amp-social-share type="gplus" width="50" height="28"></amp-social-share>
172
- <?php } ?>
173
- <?php if($redux_builder_amp['enable-single-email-share'] == true) { ?>
174
- <amp-social-share type="email" width="50" height="28"></amp-social-share>
175
- <?php } ?>
176
- <?php if($redux_builder_amp['enable-single-pinterest-share'] == true) { ?>
177
- <amp-social-share type="pinterest" width="50" height="28"></amp-social-share>
178
- <?php } ?>
179
- <?php if($redux_builder_amp['enable-single-linkedin-share'] == true) { ?>
180
- <amp-social-share type="linkedin" width="50" height="28"></amp-social-share>
181
- <?php } ?>
182
- </div>
183
- <?php } ?>
184
  </main>
185
 
186
  <?php
@@ -223,35 +162,7 @@ function ampforwp_design_3_frontpage_content($template, $post_id){
223
 
224
  <div class="amp-wp-content post-pagination-meta">
225
  <?php $template->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
226
- </div> <?php
227
-
228
-
229
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
230
- if( $redux_builder_amp['enable-single-social-icons'] == true && !is_plugin_active( 'amp-cta/amp-cta.php' ) ) { ?>
231
- <div class="sticky_social">
232
- <?php if($redux_builder_amp['enable-single-facebook-share'] == true) { ?>
233
- <amp-social-share type="facebook" width="50" height="28"></amp-social-share>
234
- <?php } ?>
235
- <?php if($redux_builder_amp['enable-single-twitter-share'] == true) { $data_param_data = $redux_builder_amp['enable-single-twitter-share-handle'];?>
236
- <amp-social-share type="twitter" width="50" height="28"
237
- data-param-url=""
238
- data-param-text="TITLE <?php echo wp_get_shortlink().' '.ampforwp_translation( $redux_builder_amp['amp-translator-via-text'], 'via' ).' '.$data_param_data ?>">
239
- </amp-social-share>
240
- <?php } ?>
241
- <?php if($redux_builder_amp['enable-single-gplus-share'] == true) { ?>
242
- <amp-social-share type="gplus" width="50" height="28"></amp-social-share>
243
- <?php } ?>
244
- <?php if($redux_builder_amp['enable-single-email-share'] == true) { ?>
245
- <amp-social-share type="email" width="50" height="28"></amp-social-share>
246
- <?php } ?>
247
- <?php if($redux_builder_amp['enable-single-pinterest-share'] == true) { ?>
248
- <amp-social-share type="pinterest" width="50" height="28"></amp-social-share>
249
- <?php } ?>
250
- <?php if($redux_builder_amp['enable-single-linkedin-share'] == true) { ?>
251
- <amp-social-share type="linkedin" width="50" height="28"></amp-social-share>
252
- <?php } ?>
253
- </div>
254
- <?php } ?>
255
  </main>
256
  <?php
257
  }
75
 
76
  <div class="amp-wp-content post-pagination-meta">
77
  <?php $template->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
78
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  </article> <?php
80
  }
81
 
119
 
120
  <div class="amp-wp-content post-pagination-meta">
121
  <?php $template->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
122
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  </main>
124
 
125
  <?php
162
 
163
  <div class="amp-wp-content post-pagination-meta">
164
  <?php $template->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
165
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  </main>
167
  <?php
168
  }
templates/instant-articles/instant-article-sanitizer.php ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_filter( 'fbia_content', 'headlines');
4
+ add_filter( 'fbia_content', 'filter_dom') ;
5
+ add_filter( 'fbia_content', 'address_tag');
6
+
7
+ remove_all_filters( 'post_gallery' );
8
+ add_filter( 'post_gallery', 'gallery_shortcode', 10, 3 );
9
+
10
+
11
+ // DOM Document Filter
12
+ if(class_exists("DOMDocument")){
13
+ add_filter( 'fbia_content_dom', 'list_items_with_content');
14
+ add_filter( 'fbia_content_dom', 'validate_images');
15
+ add_filter( 'fbia_content_dom','resize_images');
16
+
17
+ // The empty P tags class should run last
18
+ add_filter( 'fbia_content_dom','no_empty_p_tags');
19
+ }
20
+
21
+ function headlines($content){
22
+ // Replace h3, h4, h5, h6 with h2
23
+ $content = preg_replace(
24
+ '/<h[3,4,5,6][^>]*>(.*)<\/h[3,4,5,6]>/sU',
25
+ '<h2>$1</h2>',
26
+ $content
27
+ );
28
+
29
+ return $content;
30
+ }
31
+
32
+ function address_tag($content){
33
+ $content = preg_replace(
34
+ '/<address[^>]*>(.*)<\/address>/sU',
35
+ '<p>$1</p>',
36
+ $content
37
+ );
38
+
39
+ return $content;
40
+ }
41
+
42
+ function filter_dom($content){
43
+ $DOMDocument = get_content_DOM($content);
44
+
45
+ $DOMDocument = apply_filters("fbia_content_dom", $DOMDocument);
46
+
47
+ $content = get_content_from_DOM($DOMDocument);
48
+
49
+ return $content;
50
+ }
51
+
52
+ function get_content_DOM($content){
53
+ $libxml_previous_state = libxml_use_internal_errors( true );
54
+ $DOMDocument = new DOMDocument( '1.0', get_option( 'blog_charset' ) );
55
+
56
+ // DOMDocument isn’t handling encodings too well, so let’s help it a little
57
+ if ( function_exists( 'mb_convert_encoding' ) ) {
58
+ $content = mb_convert_encoding( $content, 'HTML-ENTITIES', get_option( 'blog_charset' ) );
59
+ }
60
+
61
+ $result = $DOMDocument->loadHTML( '<!doctype html><html><body>' . utf8_decode( $content ) . '</body></html>' );
62
+ libxml_clear_errors();
63
+ libxml_use_internal_errors( $libxml_previous_state );
64
+
65
+ return $DOMDocument;
66
+ }
67
+
68
+ function get_content_from_DOM($DOMDocument){
69
+ $body = $DOMDocument->getElementsByTagName( 'body' )->item( 0 );
70
+ $filtered_content = '';
71
+ foreach ( $body->childNodes as $node ) {
72
+ if ( method_exists( $DOMDocument, 'saveHTML' ) && version_compare(phpversion(), '5.3.6', '>=') ) {
73
+ $filtered_content .= $DOMDocument->saveHTML( $node );// Requires PHP 5.3.6
74
+ } else {
75
+ $temp_content = $DOMDocument->saveXML( $node );
76
+ $iframe_pattern = "#<iframe([^>]+)/>#is"; // self-closing iframe element
77
+ $temp_content = preg_replace( $iframe_pattern, "<iframe$1></iframe>", $temp_content );
78
+ $filtered_content .= $temp_content;
79
+ }
80
+ }
81
+
82
+ return $filtered_content;
83
+ }
84
+
85
+ function list_items_with_content($DOMDocument){
86
+
87
+ // A set of inline tags, that are allowed within the li element
88
+ $allowed_tags = array(
89
+ "p", "b", "u", "i", "em", "span", "strong", "#text", "a"
90
+ );
91
+
92
+ // Find all the list items
93
+ $elements = $DOMDocument->getElementsByTagName( 'li' );
94
+
95
+ // Iterate over all the list items
96
+ for ( $i = 0; $i < $elements->length; ++$i ) {
97
+ $element = $elements->item( $i );
98
+
99
+ // If the list item has more than one child node, we might get a conflict, so wrap
100
+ if($element->childNodes->length > 1){
101
+ // Iterate over all child nodes
102
+ for ( $n = 0; $n < $element->childNodes->length; ++$n ) {
103
+ $childNode = $element->childNodes->item($n);
104
+
105
+ // If this child node is not one of the allowed tags remove from the DOM tree
106
+ if(!in_array($childNode->nodeName, $allowed_tags)){
107
+ $element->removeChild($childNode);
108
+ }
109
+ }
110
+ }
111
+ }
112
+
113
+ return $DOMDocument;
114
+ }
115
+
116
+ function validate_images($DOMDocument){
117
+
118
+ // Find all the image items
119
+ $elements = $DOMDocument->getElementsByTagName( 'img' );
120
+
121
+
122
+ // Iterate over all the list items
123
+ for ( $i = 0; $i < $elements->length; ++$i ) {
124
+ $element = $elements->item( $i );
125
+
126
+ if($element->parentNode->nodeName == "figure"){
127
+ // This element is already wrapped in a figure tag, we only need to make sure it's placed right
128
+ $element = $element->parentNode;
129
+ } else {
130
+ // Wrap this image into a figure tag
131
+ $figure = $DOMDocument->createElement('figure');
132
+ $element->parentNode->replaceChild($figure, $element);
133
+ $figure->appendChild($element);
134
+
135
+ // Let's continue working with the figure tag
136
+ $element = $figure;
137
+ }
138
+
139
+
140
+ if($element->parentNode->nodeName != "body"){
141
+ // Let's find the highest container if it does not reside in the body already
142
+ $highestParent = $element->parentNode;
143
+
144
+ while($highestParent->parentNode->nodeName != "body"){
145
+ $highestParent = $highestParent->parentNode;
146
+ }
147
+
148
+ // Insert the figure tag before the highest parent which is not the body tag
149
+ $highestParent->parentNode->insertBefore($element, $highestParent);
150
+ }
151
+ }
152
+
153
+ return $DOMDocument;
154
+ }
155
+
156
+ function resize_images($DOMDocument){
157
+
158
+ $default_image_size = apply_filters('fbia_default_image_size', 'full');
159
+
160
+ // Find all the images
161
+ $elements = $DOMDocument->getElementsByTagName( 'img' );
162
+
163
+ // Iterate over all the list items
164
+ for ( $i = 0; $i < $elements->length; ++$i ) {
165
+ $image = $elements->item( $i );
166
+
167
+ // Find the "wp-image" class, as it is a safe indicator for WP images and delivers the attachment ID
168
+ if(preg_match("/.*wp-image-(\d*).*/", $image->getAttribute("class"), $matches)){
169
+ if($matches[1]){
170
+ $id = intval($matches[1]);
171
+ // Find the attachment for the ID
172
+ $desired_size = wp_get_attachment_image_src($id, $default_image_size);
173
+ // If we have a valid attachment we change the attributes
174
+ if($desired_size){
175
+ $image->setAttribute("src", $desired_size[0]);
176
+ $image->setAttribute("width", $desired_size[1]);
177
+ $image->setAttribute("height", $desired_size[2]);
178
+ }
179
+ }
180
+ }
181
+ }
182
+
183
+
184
+ return $DOMDocument;
185
+ }
186
+
187
+ function no_empty_p_tags($DOMDocument){
188
+ $allowed_tags = array(
189
+ "p", "b", "u", "i", "em", "span", "strong", "#text", "a"
190
+ );
191
+
192
+ // Find all the paragraph items
193
+ $elements = $DOMDocument->getElementsByTagName( 'p' );
194
+
195
+ // Iterate over all the paragraph items
196
+ for ( $i = 0; $i < $elements->length; ++$i ) {
197
+ $element = $elements->item( $i );
198
+
199
+ if($element->childNodes->length == 0){
200
+ // This element is empty like <p></p>
201
+ $element->parentNode->removeChild($element);
202
+ } elseif( $element->childNodes->length >= 1 ) {
203
+ // This element actually has children, let's see if it has text
204
+
205
+ $elementHasText = false;
206
+ // Iterate over all child nodes
207
+ for ( $n = 0; $n < $element->childNodes->length; ++$n ) {
208
+ $childNode = $element->childNodes->item($n);
209
+
210
+ if(in_array($childNode->nodeName, $allowed_tags)){
211
+
212
+ // If the child node has text, check if it is empty text
213
+ // isset($childNode->childNodes->length) || !isset($childNode->nodeValue) || trim($childNode->nodeValue,chr(0xC2).chr(0xA0)) == false
214
+
215
+ if( (!isset($childNode->childNodes) || $childNode->childNodes->length == 0) && (isset($childNode->nodeValue) && !trim($childNode->nodeValue,chr(0xC2).chr(0xA0)))){
216
+ // this node is empty
217
+ $element->removeChild($childNode);
218
+ } else {
219
+ $elementHasText = true;
220
+ }
221
+ }
222
+ }
223
+
224
+ if(!$elementHasText){
225
+ // The element has child nodes, but no text
226
+ $fragment = $DOMDocument->createDocumentFragment();
227
+
228
+ // move all child nodes into a fragment
229
+ while($element->hasChildNodes()){
230
+ $fragment->appendChild( $element->childNodes->item( 0 ) );
231
+ }
232
+
233
+ // replace the (now empty) p tag with the fragment
234
+ $element->parentNode->replaceChild($fragment, $element);
235
+ }
236
+ }
237
+ }
238
+
239
+ return $DOMDocument;
240
+ }
241
+
242
+ function fb_gallery_shortcode($output, $attr, $instance){
243
+ $post = get_post();
244
+
245
+ $atts = shortcode_atts( array(
246
+ 'order' => 'ASC',
247
+ 'orderby' => 'menu_order ID',
248
+ 'id' => $post ? $post->ID : 0,
249
+ 'itemtag' => 'figure',
250
+ 'icontag' => 'div',
251
+ 'captiontag' => 'figcaption',
252
+ 'columns' => 3,
253
+ 'size' => 'thumbnail',
254
+ 'include' => '',
255
+ 'exclude' => '',
256
+ 'link' => ''
257
+ ), $attr, 'gallery' );
258
+
259
+ if ( ! empty( $atts['include'] ) ) {
260
+ $_attachments = get_posts( array( 'include' => $atts['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
261
+ $attachments = array();
262
+ foreach ( $_attachments as $key => $val ) {
263
+ $attachments[$val->ID] = $_attachments[$key];
264
+ }
265
+ } elseif ( ! empty( $atts['exclude'] ) ) {
266
+ $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
267
+ } else {
268
+ $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
269
+ }
270
+ if ( empty( $attachments ) ) {
271
+ return '';
272
+ }
273
+
274
+ // Build the gallery html output
275
+ $output = "<figure class=\"op-slideshow\">";
276
+
277
+ // Iterate over the available images
278
+ $i = 0;
279
+ foreach ( $attachments as $id => $attachment ) {
280
+ $attr = ( trim( $attachment->post_excerpt ) ) ? array( 'aria-describedby' => "gallery-$id" ) : '';
281
+ $image_output = wp_get_attachment_image( $id, "full", false, $attr );
282
+
283
+ $image_meta = wp_get_attachment_metadata( $id );
284
+ $orientation = '';
285
+ if ( isset( $image_meta['height'], $image_meta['width'] ) ) {
286
+ $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
287
+ }
288
+ $output .= "<figure>";
289
+ $output .= "
290
+ $image_output";
291
+ if ( trim($attachment->post_excerpt) ) {
292
+ $output .= "
293
+ <figcaption>
294
+ " . wptexturize($attachment->post_excerpt) . "
295
+ </figcaption>";
296
+ }
297
+ $output .= "</figure>";
298
+ }
299
+
300
+
301
+ $output .= "</figure>";
302
+
303
+ return $output;
304
+ }
templates/instant-articles/instant-article.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en" prefix="op: http://media.facebook.com/op#">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <link rel="canonical" href="<?php the_permalink(); ?>">
6
+ <meta property="op:markup_version" content="v1.0">
7
+ </head>
8
+ <body>
9
+ <article>
10
+ <header>
11
+ <!-- title -->
12
+ <h1><?php the_title(); ?></h1>
13
+
14
+ <!-- kicker -->
15
+ <!-- TODO -->
16
+
17
+ <!-- publication date/time -->
18
+ <time class="op-published" datetime="<?php echo get_the_date("c"); ?>"><?php echo get_the_date(get_option('date_format') . ", " . get_option('time_format')); ?></time>
19
+
20
+ <!-- modification date/time -->
21
+ <time class="op-modified" datetime="<?php echo get_the_modified_date("c"); ?>"><?php echo get_the_modified_date(get_option('date_format') . ", " . get_option('time_format')); ?></time>
22
+
23
+ <!-- author(s) -->
24
+ <address>
25
+ <a><?php the_author_meta('display_name'); ?></a>
26
+ <?php the_author_meta('description'); ?>
27
+ </address>
28
+
29
+ <!-- cover -->
30
+ <?php if(has_post_thumbnail($post->ID)):
31
+ $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );
32
+ $attachment = get_post(get_post_thumbnail_id($post->ID));
33
+ $thumbnail_url = $thumb[0];
34
+ ?>
35
+ <figure>
36
+ <img src="<?php echo $thumbnail_url; ?>" />
37
+ <?php if (strlen(apply_filters("the_content", $attachment->post_excerpt)) > 0): ?>
38
+ <figcaption><?php echo apply_filters("the_content", $attachment->post_excerpt); ?></figcaption>
39
+ <?php endif; ?>
40
+ </figure>
41
+ <?php endif; ?>
42
+
43
+ </header>
44
+
45
+ <!-- body -->
46
+ <?php
47
+ echo apply_filters('fbia_content', apply_filters('the_content', get_the_content( '' ))); ?>
48
+ <footer>
49
+ </footer>
50
+ </article>
51
+ </body>
52
+ </html>