AMP for WP – Accelerated Mobile Pages - Version 0.9.60

Version Description

(4th September 2017) = * View more details on https://ampforwp.com/0-9-60-released-improved-redirection-66th-update/ * Class added to View non-amp anchor tag * Params added properly to get rid of a warning #1077 * rel=attachment noopener generating validation errors #1090 * Breadcrumbs Support Added #701 * Enable / Disable button added for Navigation Menu #735 * Move the ad code for Instant Article down after the article #964 * Add analytics code of FB instant articles properly #1096 * datetime Tag not stripping properly #1043 * Mobile redirection on custom post types #1028 #1052 * Mobile Redirection causing extra redirect #879 #933 * Proper mobile redirection on Homepage #1052 * View non-amp on blog will redirect to blog * Blog will redirect to blog irrespective of AMP Homepage option #871 * Dont redirect if archive support is disabled #1052 * non-amp category pages should redirect to non-amp pages if turned off from Hide AMP #999 * Disable amp for forum plugin (wpforo) #592

Download this release

Release Info

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

Code changes from version 0.9.59 to 0.9.60

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.59
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -18,7 +18,7 @@ define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
18
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
19
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
20
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
21
- define('AMPFORWP_VERSION','0.9.59');
22
  // any changes to AMP_QUERY_VAR should be refelected here
23
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
24
 
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.60
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
18
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
19
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
20
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
21
+ define('AMPFORWP_VERSION','0.9.60');
22
  // any changes to AMP_QUERY_VAR should be refelected here
23
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
24
 
classes/class-ampforwp-youtube-embed.php CHANGED
@@ -92,7 +92,9 @@ class AMPforWP_YouTube_Embed_Handler extends AMP_Base_Embed_Handler {
92
  private function get_video_id_from_url( $url ) {
93
  $video_id = false;
94
  $parsed_url = parse_url( $url );
95
-
 
 
96
  if ( self::SHORT_URL_HOST === substr( $parsed_url['host'], -strlen( self::SHORT_URL_HOST ) ) ) {
97
  // youtu.be/{id}
98
  $parts = explode( '/', $parsed_url['path'] );
92
  private function get_video_id_from_url( $url ) {
93
  $video_id = false;
94
  $parsed_url = parse_url( $url );
95
+ if(!isset($parsed_url['host'])){
96
+ $parsed_url['host'] = '';
97
+ }
98
  if ( self::SHORT_URL_HOST === substr( $parsed_url['host'], -strlen( self::SHORT_URL_HOST ) ) ) {
99
  // youtu.be/{id}
100
  $parts = explode( '/', $parsed_url['path'] );
includes/options/admin-config.php CHANGED
@@ -1269,6 +1269,15 @@ Redux::setArgs( "redux_builder_amp", $args );
1269
  'subsection' => true,
1270
  'fields' => array(
1271
 
 
 
 
 
 
 
 
 
 
1272
  array(
1273
  'id' => 'ampforwp-auto-amp-menu-link',
1274
  'type' => 'switch',
@@ -1276,7 +1285,8 @@ Redux::setArgs( "redux_builder_amp", $args );
1276
  'subtitle' => __('Automatically add <code>AMP</code> at the end of menu url', 'accelerated-mobile-pages'),
1277
  'true' => 'true',
1278
  'false' => 'false',
1279
- 'default' => 0
 
1280
  ),
1281
  )
1282
  )
1269
  'subsection' => true,
1270
  'fields' => array(
1271
 
1272
+ array(
1273
+ 'id' => 'ampforwp-amp-menu',
1274
+ 'type' => 'switch',
1275
+ 'title' => __('Show/Hide Navigation Menu in AMP', 'accelerated-mobile-pages'),
1276
+ 'subtitle' => __('The switch to Enable/Disable Menu in all AMP Pages', 'accelerated-mobile-pages'),
1277
+ 'true' => 'true',
1278
+ 'false' => 'false',
1279
+ 'default' => 1
1280
+ ),
1281
  array(
1282
  'id' => 'ampforwp-auto-amp-menu-link',
1283
  'type' => 'switch',
1285
  'subtitle' => __('Automatically add <code>AMP</code> at the end of menu url', 'accelerated-mobile-pages'),
1286
  'true' => 'true',
1287
  'false' => 'false',
1288
+ 'default' => 0,
1289
+ 'required' => array('ampforwp-amp-menu', '=' , '1')
1290
  ),
1291
  )
1292
  )
includes/redirect.php CHANGED
@@ -2,12 +2,15 @@
2
  // Redirection for Homepage and Archive Pages when Turned Off from options panel
3
  function ampforwp_check_amp_page_status() {
4
  global $redux_builder_amp;
5
-
 
6
  if ( ampforwp_is_amp_endpoint() ) {
7
- if ( is_archive() && $redux_builder_amp['ampforwp-archive-support'] == 0 ) {
8
  global $wp;
9
  $redirection_location = add_query_arg( '', '', home_url( $wp->request ) );
 
10
  $redirection_location = trailingslashit($redirection_location );
 
11
  $redirection_location = dirname($redirection_location);
12
  wp_safe_redirect( $redirection_location );
13
  exit;
@@ -20,14 +23,22 @@ add_action( 'template_redirect', 'ampforwp_check_amp_page_status', 10 );
20
  function ampforwp_page_template_redirect() {
21
  global $redux_builder_amp;
22
  $post_type = '';
23
-
 
 
 
 
 
24
  if( isset($redux_builder_amp['amp-mobile-redirection']) && $redux_builder_amp['amp-mobile-redirection']){
25
 
26
  if( ampforwp_meta_redirection_status()=='disable' ){
27
  return;
28
  }
29
 
30
- if($post_type == 'forum'){
 
 
 
31
  return;
32
  }
33
  // Return if some categories are selected as Hide #999
@@ -69,8 +80,19 @@ function ampforwp_page_template_redirect() {
69
  if( !isset($_SESSION['ampforwp_amp_mode']) || !isset($_GET['nonamp']) ) {
70
  $_SESSION['ampforwp_amp_mode']='mobile-on';
71
  if ( is_home() ) {
 
 
 
 
 
 
 
 
 
 
 
72
  if ( $redux_builder_amp['ampforwp-homepage-on-off-support'] == 1 ) {
73
- wp_redirect( trailingslashit( esc_url( home_url() ) ) . AMPFORWP_AMP_QUERY_VAR , 301 );
74
  exit();
75
  }
76
  }
@@ -78,15 +100,19 @@ function ampforwp_page_template_redirect() {
78
  if ( $redux_builder_amp['ampforwp-archive-support'] == 1 ) {
79
  global $wp;
80
  $current_archive_url = home_url( $wp->request );
81
- wp_redirect( trailingslashit( esc_url( $current_archive_url ) ) . AMPFORWP_AMP_QUERY_VAR , 301 );
82
  exit();
83
  }
84
  } else {
85
  $ampforwp_amp_post_on_off_meta = get_post_meta( get_the_ID(),'ampforwp-amp-on-off',true);
86
  if( $ampforwp_amp_post_on_off_meta === 'hide-amp' ) {
87
  //dont Echo anything
88
- } else {
89
- wp_redirect( trailingslashit( esc_url( ( get_permalink( $id ) ) ) ) . AMPFORWP_AMP_QUERY_VAR , 301 );
 
 
 
 
90
  exit();
91
  }
92
  }
2
  // Redirection for Homepage and Archive Pages when Turned Off from options panel
3
  function ampforwp_check_amp_page_status() {
4
  global $redux_builder_amp;
5
+ $hide_cats_amp = '';
6
+ $hide_cats_amp = is_category_amp_disabled();
7
  if ( ampforwp_is_amp_endpoint() ) {
8
+ if ( is_archive() && ($redux_builder_amp['ampforwp-archive-support'] == 0 || $hide_cats_amp == true) ) {
9
  global $wp;
10
  $redirection_location = add_query_arg( '', '', home_url( $wp->request ) );
11
+
12
  $redirection_location = trailingslashit($redirection_location );
13
+
14
  $redirection_location = dirname($redirection_location);
15
  wp_safe_redirect( $redirection_location );
16
  exit;
23
  function ampforwp_page_template_redirect() {
24
  global $redux_builder_amp;
25
  $post_type = '';
26
+ $supported_types = '';
27
+ $supported_amp_post_types = '';
28
+ $supported_types = array('post','page');
29
+ $supported_types = apply_filters('get_amp_supported_post_types',$supported_types);
30
+ $post_type = get_post_type();
31
+ $supported_amp_post_types = in_array( $post_type , $supported_types );
32
  if( isset($redux_builder_amp['amp-mobile-redirection']) && $redux_builder_amp['amp-mobile-redirection']){
33
 
34
  if( ampforwp_meta_redirection_status()=='disable' ){
35
  return;
36
  }
37
 
38
+ if($supported_amp_post_types == false){
39
+ return;
40
+ }
41
+ if(is_archive() && $redux_builder_amp['ampforwp-archive-support']==0){
42
  return;
43
  }
44
  // Return if some categories are selected as Hide #999
80
  if( !isset($_SESSION['ampforwp_amp_mode']) || !isset($_GET['nonamp']) ) {
81
  $_SESSION['ampforwp_amp_mode']='mobile-on';
82
  if ( is_home() ) {
83
+ if( get_option( 'page_for_posts' ) && get_queried_object_id() ) {
84
+ $post_id = get_option('page_for_posts');
85
+ $ampforwp_amp_post_on_off_meta = get_post_meta( get_the_ID(),'ampforwp-amp-on-off',true);
86
+ if( $ampforwp_amp_post_on_off_meta === 'hide-amp' ) {
87
+ //dont Echo anything
88
+ } else {
89
+ wp_redirect( trailingslashit(trailingslashit( esc_url( ( get_permalink( $post_id ) ) ) ) . AMPFORWP_AMP_QUERY_VAR ) , 301 );
90
+ exit();
91
+ }
92
+ }
93
+
94
  if ( $redux_builder_amp['ampforwp-homepage-on-off-support'] == 1 ) {
95
+ wp_redirect( trailingslashit(trailingslashit( esc_url( home_url() ) ) . AMPFORWP_AMP_QUERY_VAR ) , 301 );
96
  exit();
97
  }
98
  }
100
  if ( $redux_builder_amp['ampforwp-archive-support'] == 1 ) {
101
  global $wp;
102
  $current_archive_url = home_url( $wp->request );
103
+ wp_redirect( trailingslashit(trailingslashit( esc_url( $current_archive_url ) ) . AMPFORWP_AMP_QUERY_VAR ) , 301 );
104
  exit();
105
  }
106
  } else {
107
  $ampforwp_amp_post_on_off_meta = get_post_meta( get_the_ID(),'ampforwp-amp-on-off',true);
108
  if( $ampforwp_amp_post_on_off_meta === 'hide-amp' ) {
109
  //dont Echo anything
110
+ }
111
+ elseif($redux_builder_amp['ampforwp-homepage-on-off-support'] == 0 &&get_option('page_on_front')){
112
+ return;
113
+ }
114
+ else {
115
+ wp_redirect( trailingslashit(trailingslashit( esc_url( ( get_permalink( $id ) ) ) ) . AMPFORWP_AMP_QUERY_VAR ) , 301 );
116
  exit();
117
  }
118
  }
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.8.1
7
- Stable tag: 0.9.59
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -29,6 +29,7 @@ Bug reports for AMP for WP are [welcomed on GitHub](https://github.com/ahmedkalu
29
 
30
  = Features: =
31
 
 
32
  * NEW - Gravity Forms Support [More Info](https://ampforwp.com/gravity-forms/)
33
  * NEW - AMP Plugins Manager - Which allows you to disable a specific plugin functionality only in the AMP version
34
  * NEW - Page Break / NextPage (Pagination) Support
@@ -85,7 +86,8 @@ Bug reports for AMP for WP are [welcomed on GitHub](https://github.com/ahmedkalu
85
  * Incontent & DoubleClick Support
86
  * Great Support & Active Development.
87
  * Widgets & WooCommerce
88
- * NEW - Genesis SEO Support
 
89
  * NEW - Facebook Instant Articles Support Added
90
 
91
  **[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.
@@ -140,6 +142,25 @@ You can contact me using this url: http://ampforwp.com/contact/
140
 
141
  == Changelog ==
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  = 0.9.59 (23th August 2017) =
144
  * Design 3 Images were not aligned properly. Fixed. #1040
145
  * Caption in the design 3 improved
4
  Donate link: https://www.paypal.me/Kaludi/5
5
  Requires at least: 3.0
6
  Tested up to: 4.8.1
7
+ Stable tag: 0.9.60
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
29
 
30
  = Features: =
31
 
32
+ * NEW - Advanced WooCommerce Support [More Info](https://ampforwp.com/woocommerce/)
33
  * NEW - Gravity Forms Support [More Info](https://ampforwp.com/gravity-forms/)
34
  * NEW - AMP Plugins Manager - Which allows you to disable a specific plugin functionality only in the AMP version
35
  * NEW - Page Break / NextPage (Pagination) Support
86
  * Incontent & DoubleClick Support
87
  * Great Support & Active Development.
88
  * Widgets & WooCommerce
89
+ * Genesis SEO Support
90
+ * NEW - Breadcrumb Support added
91
  * NEW - Facebook Instant Articles Support Added
92
 
93
  **[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.
142
 
143
  == Changelog ==
144
 
145
+ = 0.9.60 (4th September 2017) =
146
+ * View more details on https://ampforwp.com/0-9-60-released-improved-redirection-66th-update/
147
+ * Class added to View non-amp anchor tag
148
+ * Params added properly to get rid of a warning #1077
149
+ * rel=attachment noopener generating validation errors #1090
150
+ * Breadcrumbs Support Added #701
151
+ * Enable / Disable button added for Navigation Menu #735
152
+ * Move the ad code for Instant Article down after the article #964
153
+ * Add analytics code of FB instant articles properly #1096
154
+ * datetime Tag not stripping properly #1043
155
+ * Mobile redirection on custom post types #1028 #1052
156
+ * Mobile Redirection causing extra redirect #879 #933
157
+ * Proper mobile redirection on Homepage #1052
158
+ * View non-amp on blog will redirect to blog
159
+ * Blog will redirect to blog irrespective of AMP Homepage option #871
160
+ * Dont redirect if archive support is disabled #1052
161
+ * non-amp category pages should redirect to non-amp pages if turned off from Hide AMP #999
162
+ * Disable amp for forum plugin (wpforo) #592
163
+
164
  = 0.9.59 (23th August 2017) =
165
  * Design 3 Images were not aligned properly. Fixed. #1040
166
  * Caption in the design 3 improved
templates/customizer/assets/customizer-preview.js CHANGED
@@ -8,6 +8,10 @@
8
  $('.ampforwp-title').show();
9
  $('.ampforwp-title').appendTo('.amp-wp-article');
10
  break;
 
 
 
 
11
  case 'meta_info:1':
12
  $('.ampforwp-meta-info').show();
13
  $('.ampforwp-meta-info').appendTo('.amp-wp-article');
8
  $('.ampforwp-title').show();
9
  $('.ampforwp-title').appendTo('.amp-wp-article');
10
  break;
11
+ case 'bread_crumbs:1':
12
+ $('.ampforwp-bread-crumbs').show();
13
+ $('.ampforwp-bread-crumbs').appendTo('.amp-wp-article');
14
+ break;
15
  case 'meta_info:1':
16
  $('.ampforwp-meta-info').show();
17
  $('.ampforwp-meta-info').appendTo('.amp-wp-article');
templates/customizer/customizer-new.php CHANGED
@@ -161,6 +161,11 @@ class AMPFORWP_Customizer_Design_Contols extends AMP_Customizer_Design_Settings
161
  'id' => 'title',
162
  'label' => __( 'Title', 'accelerated-mobile-pages' ),
163
  );
 
 
 
 
 
164
 
165
  /* Featured Image */
166
  $services['featured_image'] = array(
161
  'id' => 'title',
162
  'label' => __( 'Title', 'accelerated-mobile-pages' ),
163
  );
164
+ /* Breadcrumbs */
165
+ $services['bread_crumbs'] = array(
166
+ 'id' => 'bread_crumbs',
167
+ 'label' => __( 'Breadcrumb', 'accelerated-mobile-pages' ),
168
+ );
169
 
170
  /* Featured Image */
171
  $services['featured_image'] = array(
templates/customizer/customizer.php CHANGED
@@ -161,7 +161,11 @@ class AMPFORWP_Customizer_Design_Contols extends AMP_Customizer_Design_Settings
161
  'id' => 'title',
162
  'label' => __( 'Title', 'accelerated-mobile-pages' ),
163
  );
164
-
 
 
 
 
165
  /* Featured Image */
166
  $services['featured_image'] = array(
167
  'id' => 'featured_image',
161
  'id' => 'title',
162
  'label' => __( 'Title', 'accelerated-mobile-pages' ),
163
  );
164
+ /* Breadcrumbs */
165
+ $services['bread_crumbs'] = array(
166
+ 'id' => 'bread_crumbs',
167
+ 'label' => __( 'Breadcrumb', 'accelerated-mobile-pages' ),
168
+ );
169
  /* Featured Image */
170
  $services['featured_image'] = array(
171
  'id' => 'featured_image',
templates/design-manager.php CHANGED
@@ -9,6 +9,8 @@ if ( is_customize_preview() ) {
9
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_social_icons' );
10
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_comments' );
11
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_related_posts' );
 
 
12
  // add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_simple_comment_button' );
13
  }
14
 
@@ -16,7 +18,7 @@ if ( is_customize_preview() ) {
16
 
17
  // Adding default Value
18
  if ($data['elements'] == '') {
19
- $data['elements'] = "meta_info:1,title:1,featured_image:1,content:1,meta_taxonomy:1,social_icons:1,comments:1,related_posts:1";
20
  }
21
 
22
  if( isset( $data['elements'] ) || ! empty( $data['elements'] ) ){
@@ -26,6 +28,9 @@ if ( is_customize_preview() ) {
26
  if ($options): foreach ($options as $key=>$value) {
27
  if ( ! is_customize_preview() ) {
28
  switch ($value) {
 
 
 
29
  case 'title:1':
30
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_the_title' );
31
  break;
@@ -118,7 +123,6 @@ function ampforwp_design_element_meta_info( $file, $type, $post ) {
118
  return $file;
119
  }
120
 
121
-
122
  // Featured Image
123
  function ampforwp_add_element_featured_image( $meta_parts ) {
124
  $meta_parts[] = 'ampforwp-featured-image';
@@ -134,7 +138,20 @@ function ampforwp_design_element_featured_image( $file, $type, $post ) {
134
  return $file;
135
  }
136
 
 
 
 
 
 
 
 
137
 
 
 
 
 
 
 
138
  // The Content
139
  function ampforwp_add_element_the_content( $meta_parts ) {
140
  $meta_parts[] = 'ampforwp-the-content';
9
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_social_icons' );
10
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_comments' );
11
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_related_posts' );
12
+ add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_bread_crumbs' );
13
+
14
  // add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_simple_comment_button' );
15
  }
16
 
18
 
19
  // Adding default Value
20
  if ($data['elements'] == '') {
21
+ $data['elements'] = "bread_crumbs:1,meta_info:1,title:1,featured_image:1,content:1,meta_taxonomy:1,social_icons:1,comments:1,related_posts:1";
22
  }
23
 
24
  if( isset( $data['elements'] ) || ! empty( $data['elements'] ) ){
28
  if ($options): foreach ($options as $key=>$value) {
29
  if ( ! is_customize_preview() ) {
30
  switch ($value) {
31
+ case 'bread_crumbs:1':
32
+ add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_bread_crumbs' );
33
+ break;
34
  case 'title:1':
35
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_the_title' );
36
  break;
123
  return $file;
124
  }
125
 
 
126
  // Featured Image
127
  function ampforwp_add_element_featured_image( $meta_parts ) {
128
  $meta_parts[] = 'ampforwp-featured-image';
138
  return $file;
139
  }
140
 
141
+ // Bread-Crumbs
142
+ function ampforwp_add_element_bread_crumbs( $meta_parts ) {
143
+ $meta_parts[] = 'ampforwp-bread-crumbs';
144
+ return $meta_parts;
145
+ }
146
+
147
+ add_filter( 'amp_post_template_file', 'ampforwp_design_element_bread_crumbs', 10, 3 );
148
 
149
+ function ampforwp_design_element_bread_crumbs( $file, $type, $post ) {
150
+ if ( 'ampforwp-bread-crumbs' === $type ) {
151
+ $file = AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. ampforwp_design_selector() .'/elements/bread-crumbs.php' ;
152
+ }
153
+ return $file;
154
+ }
155
  // The Content
156
  function ampforwp_add_element_the_content( $meta_parts ) {
157
  $meta_parts[] = 'ampforwp-the-content';
templates/design-manager/design-1/elements/bread-crumbs.php ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="amp-wp-content breadcrumb"> <?php
2
+ // Settings
3
+ $breadcrums_id = 'breadcrumbs';
4
+ $breadcrums_class = 'breadcrumbs';
5
+ $home_title = 'Homepage';
6
+
7
+ // If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
8
+ $custom_taxonomy = 'product_cat';
9
+
10
+ // Get the query & post information
11
+ global $post,$wp_query;
12
+
13
+ // Do not display on the homepage
14
+ if ( !is_front_page() ) {
15
+
16
+ // Build the breadcrums
17
+ echo '<ul id="' . $breadcrums_id . '" class="' . $breadcrums_class . '">';
18
+
19
+ // Home page
20
+ echo '<li class="item-home"><a class="bread-link bread-home" href="' . trailingslashit(trailingslashit( get_home_url() ) . AMPFORWP_AMP_QUERY_VAR) . '" title="' . $home_title . '">' . $home_title . '</a></li>';
21
+
22
+ if ( is_archive() && !is_tax() && !is_category() && !is_tag() && !is_author() ) {
23
+
24
+
25
+ echo '<li class="item-current item-archive"><strong class="bread-current bread-archive">' . post_type_archive_title($prefix, false) . '</strong></li>';
26
+ } else if ( is_author() ) {
27
+ global $author;
28
+
29
+ $userdata = get_userdata( $author );
30
+ $author_url= get_author_posts_url($userdata->ID);
31
+ $author_url = trailingslashit($author_url);
32
+ // Display author name
33
+ echo '<li class="item-current item-current-' . $userdata->user_nicename . '"><a class="bread-current bread-current-' . $userdata->user_nicename . '" title="' . $userdata->display_name . '" href="'.trailingslashit($author_url. AMPFORWP_AMP_QUERY_VAR ). '">' . 'Author: ' . $userdata->display_name . '</a></li>';
34
+
35
+ } else if ( is_archive() && is_tax() && !is_category() && !is_tag() ) {
36
+
37
+ // If post is a custom post type
38
+ $post_type = get_post_type();
39
+
40
+ // If it is a custom post type display name and link
41
+ if($post_type != 'post') {
42
+
43
+ $post_type_object = get_post_type_object($post_type);
44
+ $post_type_archive = get_post_type_archive_link($post_type);
45
+ $post_type_archive = trailingslashit($post_type_archive);
46
+ echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . trailingslashit($post_type_archive . AMPFORWP_AMP_QUERY_VAR) . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
47
+ }
48
+
49
+ $custom_tax_name = get_queried_object()->name;
50
+ echo '<li class="item-current item-archive"><strong class="bread-current bread-archive">' . $custom_tax_name . '</strong></li>';
51
+ } else if ( is_single() ) {
52
+
53
+ // If post is a custom post type
54
+ $post_type = get_post_type();
55
+
56
+ // If it is a custom post type display name and link
57
+ if($post_type != 'post') {
58
+
59
+ $post_type_object = get_post_type_object($post_type);
60
+ $post_type_archive = get_post_type_archive_link($post_type);
61
+ $post_type_archive = trailingslashit($post_type_archive);
62
+ echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' .trailingslashit($post_type_archive . AMPFORWP_AMP_QUERY_VAR) . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
63
+ }
64
+
65
+ // Get post category info
66
+ $category = get_the_category();
67
+
68
+ if(!empty($category)) {
69
+
70
+ // Get last category post is in
71
+ $last_category = end(array_values($category));
72
+ $category_name = get_category($last_category);
73
+ // Get parent any categories and create array
74
+ $get_cat_parents = rtrim(get_category_parents($last_category->term_id, false, ','),',');
75
+ $cat_parents = explode(',',$get_cat_parents);
76
+
77
+ // Loop through parent categories and store in variable $cat_display
78
+ $cat_display = '';
79
+ foreach($cat_parents as $parents) {
80
+ $cat_id = get_cat_ID( $parents);
81
+ $cat_link = get_category_link($cat_id);
82
+ $cat_display .= '<li class="item-cat item-cat-' . $cat_id . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $parents. '" href="'.trailingslashit(trailingslashit($cat_link).'amp').'" title="' . $parents . '">' . $parents . '</a></li>';
83
+ }
84
+ }
85
+
86
+ // If it's a custom post type within a custom taxonomy
87
+ $taxonomy_exists = taxonomy_exists($custom_taxonomy);
88
+ if(empty($last_category) && !empty($custom_taxonomy) && $taxonomy_exists) {
89
+
90
+ $taxonomy_terms = get_the_terms( $post->ID, $custom_taxonomy );
91
+ $cat_id = $taxonomy_terms[0]->term_id;
92
+ $cat_nicename = $taxonomy_terms[0]->slug;
93
+ $cat_link = get_term_link($taxonomy_terms[0]->term_id, $custom_taxonomy);
94
+ $cat_link = trailingslashit($cat_link);
95
+ $cat_name = $taxonomy_terms[0]->name;
96
+ }
97
+
98
+ // Check if the post is in a category
99
+ if(!empty($last_category)) {
100
+ echo $cat_display;
101
+
102
+ // Else if post is in a custom taxonomy
103
+ } else if(!empty($cat_id)) {
104
+
105
+ echo '<li class="item-cat item-cat-' . $cat_id . ' item-cat-' . $cat_nicename . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $cat_nicename . '" href="' . trailingslashit($cat_link .AMPFORWP_AMP_QUERY_VAR) . '" title="' . $cat_name . '">' . $cat_name . '</a></li>';
106
+ }
107
+
108
+ } else if ( is_category() ) {
109
+
110
+ // Category page
111
+ echo '<li class="item-current item-cat"><strong class="bread-current bread-cat">' . single_cat_title('', false) . '</strong></li>';
112
+ } else if ( is_page() ) {
113
+
114
+ // Standard page
115
+ if( $post->post_parent ){
116
+
117
+ // If child page, get parents
118
+ $anc = get_post_ancestors( $post->ID );
119
+
120
+ // Get parents in the right order
121
+ $anc = array_reverse($anc);
122
+
123
+ // Parent page loop
124
+ if ( !isset( $parents ) ) $parents = null;
125
+ foreach ( $anc as $ancestor ) {
126
+ $parents .= '<li class="item-parent item-parent-' . $ancestor . '"><a class="bread-parent bread-parent-' . $ancestor . '" href="' . trailingslashit(trailingslashit(get_permalink($ancestor)) . AMPFORWP_AMP_QUERY_VAR) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>';
127
+ }
128
+
129
+ // Display parent pages
130
+ echo $parents;
131
+
132
+ // Current page
133
+
134
+ }
135
+
136
+ } else if ( is_tag() ) {
137
+
138
+ // Tag page
139
+
140
+ // Get tag information
141
+ $term_id = get_query_var('tag_id');
142
+ $taxonomy = 'post_tag';
143
+ $args = 'include=' . $term_id;
144
+ $terms = get_terms( $taxonomy, $args );
145
+ $get_term_id = $terms[0]->term_id;
146
+ $get_term_slug = $terms[0]->slug;
147
+ $get_term_name = $terms[0]->name;
148
+
149
+ // Display the tag name
150
+ echo '<li class="item-current item-tag-' . $get_term_id . ' item-tag-' . $get_term_slug . '"><strong class="bread-current bread-tag-' . $get_term_id . ' bread-tag-' . $get_term_slug . '">' . $get_term_name . '</strong></li>';
151
+ } elseif ( is_day() ) {
152
+
153
+ // Day archive
154
+
155
+ // Year link
156
+ echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link( get_the_time('Y') ) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</a></li>';
157
+
158
+ // Month link
159
+ echo '<li class="item-month item-month-' . get_the_time('m') . '"><a class="bread-month bread-month-' . get_the_time('m') . '" href="' . get_month_link( get_the_time('Y'), get_the_time('m') ) . '" title="' . get_the_time('M') . '">' . get_the_time('M') . ' Archives</a></li>';
160
+
161
+
162
+ // Day display
163
+ echo '<li class="item-current item-' . get_the_time('j') . '"><strong class="bread-current bread-' . get_the_time('j') . '"> ' . get_the_time('jS') . ' ' . get_the_time('M') . ' Archives</strong></li>';
164
+
165
+ } else if ( is_month() ) {
166
+
167
+ // Month Archive
168
+
169
+ // Year link
170
+ echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link( get_the_time('Y') ) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</a></li>';
171
+
172
+ // Month display
173
+ echo '<li class="item-month item-month-' . get_the_time('m') . '"><strong class="bread-month bread-month-' . get_the_time('m') . '" title="' . get_the_time('M') . '">' . get_the_time('M') . ' Archives</strong></li>';
174
+
175
+ } else if ( is_year() ) {
176
+
177
+ // Display year archive
178
+ echo '<li class="item-current item-current-' . get_the_time('Y') . '"><strong class="bread-current bread-current-' . get_the_time('Y') . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</strong></li>';
179
+
180
+ } else if ( get_query_var('paged') ) {
181
+
182
+ // Paginated archives
183
+ echo '<li class="item-current item-current-' . get_query_var('paged') . '"><strong class="bread-current bread-current-' . get_query_var('paged') . '" title="Page ' . get_query_var('paged') . '">'.__('Page') . ' ' . get_query_var('paged') . '</strong></li>';
184
+
185
+ } else if ( is_search() ) {
186
+
187
+ // Search results page
188
+ echo '<li class="item-current item-current-' . get_search_query() . '"><strong class="bread-current bread-current-' . get_search_query() . '" title="Search results for: ' . get_search_query() . '">Search results for: ' . get_search_query() . '</strong></li>';
189
+
190
+ } elseif ( is_404() ) {
191
+
192
+ // 404 page
193
+ echo '<li>' . 'Error 404' . '</li>';
194
+ }
195
+ echo '</ul>';
196
+
197
+ }?>
198
+ </div>
templates/design-manager/design-1/header-bar.php CHANGED
@@ -57,7 +57,7 @@
57
  <amp-img src="<?php echo esc_url( $site_icon_url ); ?>" width="32" height="32" class="amp-wp-site-icon"></amp-img>
58
  <?php endif; ?>
59
  </a>
60
-
61
  <div on='tap:sidebar.toggle' role="button" tabindex="0" class="nav_container">
62
  <a href="#" class="toggle-text">
63
  <span></span>
@@ -65,6 +65,7 @@
65
  <span></span>
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'); ?>
@@ -73,6 +74,7 @@
73
 
74
  </div>
75
  </header>
 
76
  <amp-sidebar id='sidebar'
77
  layout="nodisplay"
78
  side="right">
@@ -84,6 +86,5 @@
84
  echo strip_tags( $menu , '<ul><li><a>'); ?>
85
  </div>
86
  </amp-sidebar>
87
-
88
- <?php
89
  do_action('ampforwp_design_1_after_header');
57
  <amp-img src="<?php echo esc_url( $site_icon_url ); ?>" width="32" height="32" class="amp-wp-site-icon"></amp-img>
58
  <?php endif; ?>
59
  </a>
60
+ <?php if(isset($redux_builder_amp['ampforwp-amp-menu']) && $redux_builder_amp['ampforwp-amp-menu']){ ?>
61
  <div on='tap:sidebar.toggle' role="button" tabindex="0" class="nav_container">
62
  <a href="#" class="toggle-text">
63
  <span></span>
65
  <span></span>
66
  </a>
67
  </div>
68
+ <?php } ?>
69
  <?php do_action('ampforwp_header_search'); ?>
70
  <?php do_action('ampforwp_call_button');
71
  do_action('ampforwp_header_bottom_design1'); ?>
74
 
75
  </div>
76
  </header>
77
+ <?php if(isset($redux_builder_amp['ampforwp-amp-menu']) && $redux_builder_amp['ampforwp-amp-menu']){ ?>
78
  <amp-sidebar id='sidebar'
79
  layout="nodisplay"
80
  side="right">
86
  echo strip_tags( $menu , '<ul><li><a>'); ?>
87
  </div>
88
  </amp-sidebar>
89
+ <?php }
 
90
  do_action('ampforwp_design_1_after_header');
templates/design-manager/design-1/single.php CHANGED
@@ -16,7 +16,7 @@
16
 
17
  <article class="amp-wp-article">
18
  <?php do_action('ampforwp_post_before_design_elements') ?>
19
-
20
  <?php $this->load_parts( apply_filters( 'ampforwp_design_elements', array( 'empty-filter' ) ) ); ?>
21
 
22
  <?php do_action('ampforwp_post_after_design_elements') ?>
16
 
17
  <article class="amp-wp-article">
18
  <?php do_action('ampforwp_post_before_design_elements') ?>
19
+ <?php $this->load_parts( array( 'bread-crumbs' ) ); ?>
20
  <?php $this->load_parts( apply_filters( 'ampforwp_design_elements', array( 'empty-filter' ) ) ); ?>
21
 
22
  <?php do_action('ampforwp_post_after_design_elements') ?>
templates/design-manager/design-1/style.php CHANGED
@@ -135,4 +135,11 @@ header, amp-sidebar, article, footer{ direction: rtl;}
135
  if ( class_exists('TablePress') ) { ?>
136
  .tablepress-table-description{clear:both;display:block}.tablepress{border-collapse:collapse;border-spacing:0;width:100%;margin-bottom:1em;border:none}.tablepress td,.tablepress th{padding:8px;border:none;background:0 0;text-align:left}.tablepress tbody td{vertical-align:top}.tablepress tbody td,.tablepress tfoot th{border-top:1px solid #ddd}.tablepress tbody tr:first-child td{border-top:0}.tablepress thead th{border-bottom:1px solid #ddd}.tablepress tfoot th,.tablepress thead th{background-color:#d9edf7;font-weight:700;vertical-align:middle}.tablepress .odd td{background-color:#f9f9f9}.tablepress .even td{background-color:#fff}.tablepress .row-hover tr:hover td{background-color:#f3f3f3}@media (min-width:768px) and (max-width:1600px){.tablepress{overflow-x:none}}@media (min-width:320px) and (max-width:767px){.tablepress{display:inline-block;overflow-x:scroll}}
137
  <?php } ?>
 
 
 
 
 
 
 
138
  <?php echo $redux_builder_amp['css_editor']; } ?>
135
  if ( class_exists('TablePress') ) { ?>
136
  .tablepress-table-description{clear:both;display:block}.tablepress{border-collapse:collapse;border-spacing:0;width:100%;margin-bottom:1em;border:none}.tablepress td,.tablepress th{padding:8px;border:none;background:0 0;text-align:left}.tablepress tbody td{vertical-align:top}.tablepress tbody td,.tablepress tfoot th{border-top:1px solid #ddd}.tablepress tbody tr:first-child td{border-top:0}.tablepress thead th{border-bottom:1px solid #ddd}.tablepress tfoot th,.tablepress thead th{background-color:#d9edf7;font-weight:700;vertical-align:middle}.tablepress .odd td{background-color:#f9f9f9}.tablepress .even td{background-color:#fff}.tablepress .row-hover tr:hover td{background-color:#f3f3f3}@media (min-width:768px) and (max-width:1600px){.tablepress{overflow-x:none}}@media (min-width:320px) and (max-width:767px){.tablepress{display:inline-block;overflow-x:scroll}}
137
  <?php } ?>
138
+ .breadcrumb{line-height: 1; margin: 0.1em 16px 1.5em;}
139
+ .breadcrumb ul{padding:0; margin:0;}
140
+ .breadcrumb ul li{display:inline;}
141
+ .breadcrumb ul li a{font-size:12px;}
142
+ .breadcrumb ul li a::after {content: "►";display: inline-block;font-size: 8px;padding: 0 6px 0 7px;vertical-align: middle;opacity: 0.5;position:relative;top: -1px;}
143
+ .breadcrumb ul li:hover a::after{color:#c3c3c3;}
144
+ .breadcrumb ul li:last-child a::after{display:none;}
145
  <?php echo $redux_builder_amp['css_editor']; } ?>
templates/design-manager/design-2/elements/bread-crumbs.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="breadcrumb"> <?php
2
+ // Settings
3
+ $breadcrums_id = 'breadcrumbs';
4
+ $breadcrums_class = 'breadcrumbs';
5
+ $home_title = 'Homepage';
6
+
7
+ // If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
8
+ $custom_taxonomy = 'product_cat';
9
+
10
+ // Get the query & post information
11
+ global $post,$wp_query;
12
+
13
+ // Do not display on the homepage
14
+ if ( !is_front_page() ) {
15
+
16
+ // Build the breadcrums
17
+ echo '<ul id="' . $breadcrums_id . '" class="' . $breadcrums_class . '">';
18
+
19
+ // Home page
20
+ echo '<li class="item-home"><a class="bread-link bread-home" href="' . trailingslashit( get_home_url() ) . AMPFORWP_AMP_QUERY_VAR . '" title="' . $home_title . '">' . $home_title . '</a></li>';
21
+
22
+ if ( is_archive() && !is_tax() && !is_category() && !is_tag() && !is_author() ) {
23
+
24
+
25
+ echo '<li class="item-current item-archive"><strong class="bread-current bread-archive">' . post_type_archive_title($prefix, false) . '</strong></li>';
26
+ } else if ( is_author() ) {
27
+ global $author;
28
+
29
+ $userdata = get_userdata( $author );
30
+ $author_url= get_author_posts_url($userdata->ID);
31
+
32
+ // Display author name
33
+ echo '<li class="item-current item-current-' . $userdata->user_nicename . '"><a class="bread-current bread-current-' . $userdata->user_nicename . '" title="' . $userdata->display_name . '" href="'.$author_url. AMPFORWP_AMP_QUERY_VAR . '">' . 'Author: ' . $userdata->display_name . '</a></li>';
34
+
35
+ } else if ( is_archive() && is_tax() && !is_category() && !is_tag() ) {
36
+
37
+ // If post is a custom post type
38
+ $post_type = get_post_type();
39
+
40
+ // If it is a custom post type display name and link
41
+ if($post_type != 'post') {
42
+
43
+ $post_type_object = get_post_type_object($post_type);
44
+ $post_type_archive = get_post_type_archive_link($post_type);
45
+
46
+ echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . AMPFORWP_AMP_QUERY_VAR . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
47
+ }
48
+
49
+ $custom_tax_name = get_queried_object()->name;
50
+ echo '<li class="item-current item-archive"><strong class="bread-current bread-archive">' . $custom_tax_name . '</strong></li>';
51
+ } else if ( is_single() ) {
52
+
53
+ // If post is a custom post type
54
+ $post_type = get_post_type();
55
+
56
+ // If it is a custom post type display name and link
57
+ if($post_type != 'post') {
58
+
59
+ $post_type_object = get_post_type_object($post_type);
60
+ $post_type_archive = get_post_type_archive_link($post_type);
61
+
62
+ echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . AMPFORWP_AMP_QUERY_VAR . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
63
+ }
64
+
65
+ // Get post category info
66
+ $category = get_the_category();
67
+
68
+ if(!empty($category)) {
69
+
70
+ // Get last category post is in
71
+ $last_category = end(array_values($category));
72
+ $category_name = get_category($last_category);
73
+ // Get parent any categories and create array
74
+ $get_cat_parents = rtrim(get_category_parents($last_category->term_id, false, ','),',');
75
+ $cat_parents = explode(',',$get_cat_parents);
76
+
77
+ // Loop through parent categories and store in variable $cat_display
78
+ $cat_display = '';
79
+ foreach($cat_parents as $parents) {
80
+ $cat_id = get_cat_ID( $parents);
81
+ $cat_link = get_category_link($cat_id);
82
+ $cat_display .= '<li class="item-cat item-cat-' . $parents->term_id . '"><a class="bread-cat bread-cat-' . $parents->term_id . ' bread-cat-' . $parents. '" href="'.trailingslashit(trailingslashit($cat_link).'amp').'" title="' . $parents . '">' . $parents . '</a></li>';
83
+ }
84
+ }
85
+
86
+ // If it's a custom post type within a custom taxonomy
87
+ $taxonomy_exists = taxonomy_exists($custom_taxonomy);
88
+ if(empty($last_category) && !empty($custom_taxonomy) && $taxonomy_exists) {
89
+
90
+ $taxonomy_terms = get_the_terms( $post->ID, $custom_taxonomy );
91
+ $cat_id = $taxonomy_terms[0]->term_id;
92
+ $cat_nicename = $taxonomy_terms[0]->slug;
93
+ $cat_link = get_term_link($taxonomy_terms[0]->term_id, $custom_taxonomy);
94
+ $cat_name = $taxonomy_terms[0]->name;
95
+ }
96
+
97
+ // Check if the post is in a category
98
+ if(!empty($last_category)) {
99
+ echo $cat_display;
100
+
101
+ // Else if post is in a custom taxonomy
102
+ } else if(!empty($cat_id)) {
103
+
104
+ echo '<li class="item-cat item-cat-' . $cat_id . ' item-cat-' . $cat_nicename . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $cat_nicename . '" href="' . $cat_link .AMPFORWP_AMP_QUERY_VAR . '" title="' . $cat_name . '">' . $cat_name . '</a></li>';
105
+ }
106
+
107
+ } else if ( is_category() ) {
108
+
109
+ // Category page
110
+ echo '<li class="item-current item-cat"><strong class="bread-current bread-cat">' . single_cat_title('', false) . '</strong></li>';
111
+ } else if ( is_page() ) {
112
+
113
+ // Standard page
114
+ if( $post->post_parent ){
115
+
116
+ // If child page, get parents
117
+ $anc = get_post_ancestors( $post->ID );
118
+
119
+ // Get parents in the right order
120
+ $anc = array_reverse($anc);
121
+
122
+ // Parent page loop
123
+ if ( !isset( $parents ) ) $parents = null;
124
+ foreach ( $anc as $ancestor ) {
125
+ $parents .= '<li class="item-parent item-parent-' . $ancestor . '"><a class="bread-parent bread-parent-' . $ancestor . '" href="' . get_permalink($ancestor) . AMPFORWP_AMP_QUERY_VAR . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>';
126
+ }
127
+
128
+ // Display parent pages
129
+ echo $parents;
130
+
131
+ // Current page
132
+
133
+ }
134
+
135
+ } else if ( is_tag() ) {
136
+
137
+ // Tag page
138
+
139
+ // Get tag information
140
+ $term_id = get_query_var('tag_id');
141
+ $taxonomy = 'post_tag';
142
+ $args = 'include=' . $term_id;
143
+ $terms = get_terms( $taxonomy, $args );
144
+ $get_term_id = $terms[0]->term_id;
145
+ $get_term_slug = $terms[0]->slug;
146
+ $get_term_name = $terms[0]->name;
147
+
148
+ // Display the tag name
149
+ echo '<li class="item-current item-tag-' . $get_term_id . ' item-tag-' . $get_term_slug . '"><strong class="bread-current bread-tag-' . $get_term_id . ' bread-tag-' . $get_term_slug . '">' . $get_term_name . '</strong></li>';
150
+ } elseif ( is_day() ) {
151
+
152
+ // Day archive
153
+
154
+ // Year link
155
+ echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link( get_the_time('Y') ) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</a></li>';
156
+
157
+ // Month link
158
+ echo '<li class="item-month item-month-' . get_the_time('m') . '"><a class="bread-month bread-month-' . get_the_time('m') . '" href="' . get_month_link( get_the_time('Y'), get_the_time('m') ) . '" title="' . get_the_time('M') . '">' . get_the_time('M') . ' Archives</a></li>';
159
+
160
+
161
+ // Day display
162
+ echo '<li class="item-current item-' . get_the_time('j') . '"><strong class="bread-current bread-' . get_the_time('j') . '"> ' . get_the_time('jS') . ' ' . get_the_time('M') . ' Archives</strong></li>';
163
+
164
+ } else if ( is_month() ) {
165
+
166
+ // Month Archive
167
+
168
+ // Year link
169
+ echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link( get_the_time('Y') ) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</a></li>';
170
+
171
+ // Month display
172
+ echo '<li class="item-month item-month-' . get_the_time('m') . '"><strong class="bread-month bread-month-' . get_the_time('m') . '" title="' . get_the_time('M') . '">' . get_the_time('M') . ' Archives</strong></li>';
173
+
174
+ } else if ( is_year() ) {
175
+
176
+ // Display year archive
177
+ echo '<li class="item-current item-current-' . get_the_time('Y') . '"><strong class="bread-current bread-current-' . get_the_time('Y') . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</strong></li>';
178
+
179
+ } else if ( get_query_var('paged') ) {
180
+
181
+ // Paginated archives
182
+ echo '<li class="item-current item-current-' . get_query_var('paged') . '"><strong class="bread-current bread-current-' . get_query_var('paged') . '" title="Page ' . get_query_var('paged') . '">'.__('Page') . ' ' . get_query_var('paged') . '</strong></li>';
183
+
184
+ } else if ( is_search() ) {
185
+
186
+ // Search results page
187
+ echo '<li class="item-current item-current-' . get_search_query() . '"><strong class="bread-current bread-current-' . get_search_query() . '" title="Search results for: ' . get_search_query() . '">Search results for: ' . get_search_query() . '</strong></li>';
188
+
189
+ } elseif ( is_404() ) {
190
+
191
+ // 404 page
192
+ echo '<li>' . 'Error 404' . '</li>';
193
+ }
194
+ echo '</ul>';
195
+
196
+ }?>
197
+ </div>
templates/design-manager/design-2/header-bar.php CHANGED
@@ -51,7 +51,7 @@
51
  </div>
52
  </header>
53
 
54
-
55
  <div on='tap:sidebar.toggle' role="button" tabindex="0" class="nav_container">
56
  <a href="#" class="toggle-text"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-navigate-text'], 'Navigate' ); ?></a>
57
  </div>
@@ -68,3 +68,4 @@
68
 
69
  </div>
70
  </amp-sidebar>
 
51
  </div>
52
  </header>
53
 
54
+ <?php if(isset($redux_builder_amp['ampforwp-amp-menu']) && $redux_builder_amp['ampforwp-amp-menu']){ ?>
55
  <div on='tap:sidebar.toggle' role="button" tabindex="0" class="nav_container">
56
  <a href="#" class="toggle-text"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-navigate-text'], 'Navigate' ); ?></a>
57
  </div>
68
 
69
  </div>
70
  </amp-sidebar>
71
+ <?php } ?>
templates/design-manager/design-2/single.php CHANGED
@@ -18,7 +18,7 @@
18
  <main>
19
  <article class="amp-wp-article">
20
  <?php do_action('ampforwp_post_before_design_elements') ?>
21
-
22
  <?php $this->load_parts( apply_filters( 'ampforwp_design_elements', array( 'empty-filter' ) ) ); ?>
23
  <?php do_action('ampforwp_post_after_design_elements') ?>
24
  </article>
18
  <main>
19
  <article class="amp-wp-article">
20
  <?php do_action('ampforwp_post_before_design_elements') ?>
21
+ <?php $this->load_parts( array( 'bread-crumbs' ) ); ?>
22
  <?php $this->load_parts( apply_filters( 'ampforwp_design_elements', array( 'empty-filter' ) ) ); ?>
23
  <?php do_action('ampforwp_post_after_design_elements') ?>
24
  </article>
templates/design-manager/design-2/style.php CHANGED
@@ -289,4 +289,11 @@ amp-user-notification button { background-color: <?php echo sanitize_hex_color(
289
  @media (min-width: 320px) and (max-width: 767px) {.tablepress { display: inline-block; overflow-x: scroll; } }
290
  <?php } ?>
291
  .design_2_wrapper .amp-loop-list .amp-wp-meta {display: none;}
 
 
 
 
 
 
 
292
  <?php echo $redux_builder_amp['css_editor']; } ?>
289
  @media (min-width: 320px) and (max-width: 767px) {.tablepress { display: inline-block; overflow-x: scroll; } }
290
  <?php } ?>
291
  .design_2_wrapper .amp-loop-list .amp-wp-meta {display: none;}
292
+ .breadcrumb{line-height: 1;margin-bottom:6px;}
293
+ .breadcrumb ul, .category-single ul{padding:0; margin:0;}
294
+ .breadcrumb ul li{display:inline;}
295
+ .breadcrumb ul li a{font-size:12px;}
296
+ .breadcrumb ul li a::after {content: "►";display: inline-block;font-size: 8px;padding: 0 6px 0 7px;vertical-align: middle;opacity: 0.5;position:relative;top: -0.5px;}
297
+ .breadcrumb ul li:hover a::after{color:#c3c3c3;}
298
+ .breadcrumb ul li:last-child a::after{display:none;}
299
  <?php echo $redux_builder_amp['css_editor']; } ?>
templates/design-manager/design-3/elements/bread-crumbs.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="amp-wp-content breadcrumb"> <?php
2
+ // Settings
3
+ $breadcrums_id = 'breadcrumbs';
4
+ $breadcrums_class = 'breadcrumbs';
5
+ $home_title = 'Homepage';
6
+
7
+ // If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
8
+ $custom_taxonomy = 'product_cat';
9
+
10
+ // Get the query & post information
11
+ global $post,$wp_query;
12
+
13
+ // Do not display on the homepage
14
+ if ( !is_front_page() ) {
15
+
16
+ // Build the breadcrums
17
+ echo '<ul id="' . $breadcrums_id . '" class="' . $breadcrums_class . '">';
18
+
19
+ // Home page
20
+ echo '<li class="item-home"><a class="bread-link bread-home" href="' . trailingslashit( get_home_url() ) . AMPFORWP_AMP_QUERY_VAR . '" title="' . $home_title . '">' . $home_title . '</a></li>';
21
+
22
+ if ( is_archive() && !is_tax() && !is_category() && !is_tag() && !is_author() ) {
23
+
24
+
25
+ echo '<li class="item-current item-archive"><strong class="bread-current bread-archive">' . post_type_archive_title($prefix, false) . '</strong></li>';
26
+ } else if ( is_author() ) {
27
+ global $author;
28
+
29
+ $userdata = get_userdata( $author );
30
+ $author_url= get_author_posts_url($userdata->ID);
31
+
32
+ // Display author name
33
+ echo '<li class="item-current item-current-' . $userdata->user_nicename . '"><a class="bread-current bread-current-' . $userdata->user_nicename . '" title="' . $userdata->display_name . '" href="'.$author_url. AMPFORWP_AMP_QUERY_VAR . '">' . 'Author: ' . $userdata->display_name . '</a></li>';
34
+
35
+ } else if ( is_archive() && is_tax() && !is_category() && !is_tag() ) {
36
+
37
+ // If post is a custom post type
38
+ $post_type = get_post_type();
39
+
40
+ // If it is a custom post type display name and link
41
+ if($post_type != 'post') {
42
+
43
+ $post_type_object = get_post_type_object($post_type);
44
+ $post_type_archive = get_post_type_archive_link($post_type);
45
+
46
+ echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . AMPFORWP_AMP_QUERY_VAR . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
47
+ }
48
+
49
+ $custom_tax_name = get_queried_object()->name;
50
+ echo '<li class="item-current item-archive"><strong class="bread-current bread-archive">' . $custom_tax_name . '</strong></li>';
51
+ } else if ( is_single() ) {
52
+
53
+ // If post is a custom post type
54
+ $post_type = get_post_type();
55
+
56
+ // If it is a custom post type display name and link
57
+ if($post_type != 'post') {
58
+
59
+ $post_type_object = get_post_type_object($post_type);
60
+ $post_type_archive = get_post_type_archive_link($post_type);
61
+
62
+ echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . AMPFORWP_AMP_QUERY_VAR . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
63
+ }
64
+
65
+ // Get post category info
66
+ $category = get_the_category();
67
+
68
+ if(!empty($category)) {
69
+
70
+ // Get last category post is in
71
+ $last_category = end(array_values($category));
72
+ $category_name = get_category($last_category);
73
+ // Get parent any categories and create array
74
+ $get_cat_parents = rtrim(get_category_parents($last_category->term_id, false, ','),',');
75
+ $cat_parents = explode(',',$get_cat_parents);
76
+
77
+ // Loop through parent categories and store in variable $cat_display
78
+ $cat_display = '';
79
+ foreach($cat_parents as $parents) {
80
+ $cat_id = get_cat_ID( $parents);
81
+ $cat_link = get_category_link($cat_id);
82
+ $cat_display .= '<li class="item-cat item-cat-' . $parents->term_id . '"><a class="bread-cat bread-cat-' . $parents->term_id . ' bread-cat-' . $parents. '" href="'.trailingslashit(trailingslashit($cat_link).'amp').'" title="' . $parents . '">' . $parents . '</a></li>';
83
+ }
84
+ }
85
+
86
+ // If it's a custom post type within a custom taxonomy
87
+ $taxonomy_exists = taxonomy_exists($custom_taxonomy);
88
+ if(empty($last_category) && !empty($custom_taxonomy) && $taxonomy_exists) {
89
+
90
+ $taxonomy_terms = get_the_terms( $post->ID, $custom_taxonomy );
91
+ $cat_id = $taxonomy_terms[0]->term_id;
92
+ $cat_nicename = $taxonomy_terms[0]->slug;
93
+ $cat_link = get_term_link($taxonomy_terms[0]->term_id, $custom_taxonomy);
94
+ $cat_name = $taxonomy_terms[0]->name;
95
+ }
96
+
97
+ // Check if the post is in a category
98
+ if(!empty($last_category)) {
99
+ echo $cat_display;
100
+
101
+ // Else if post is in a custom taxonomy
102
+ } else if(!empty($cat_id)) {
103
+
104
+ echo '<li class="item-cat item-cat-' . $cat_id . ' item-cat-' . $cat_nicename . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $cat_nicename . '" href="' . $cat_link .AMPFORWP_AMP_QUERY_VAR . '" title="' . $cat_name . '">' . $cat_name . '</a></li>';
105
+ }
106
+
107
+ } else if ( is_category() ) {
108
+
109
+ // Category page
110
+ echo '<li class="item-current item-cat"><strong class="bread-current bread-cat">' . single_cat_title('', false) . '</strong></li>';
111
+ } else if ( is_page() ) {
112
+
113
+ // Standard page
114
+ if( $post->post_parent ){
115
+
116
+ // If child page, get parents
117
+ $anc = get_post_ancestors( $post->ID );
118
+
119
+ // Get parents in the right order
120
+ $anc = array_reverse($anc);
121
+
122
+ // Parent page loop
123
+ if ( !isset( $parents ) ) $parents = null;
124
+ foreach ( $anc as $ancestor ) {
125
+ $parents .= '<li class="item-parent item-parent-' . $ancestor . '"><a class="bread-parent bread-parent-' . $ancestor . '" href="' . get_permalink($ancestor) . AMPFORWP_AMP_QUERY_VAR . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>';
126
+ }
127
+
128
+ // Display parent pages
129
+ echo $parents;
130
+
131
+ // Current page
132
+
133
+ }
134
+
135
+ } else if ( is_tag() ) {
136
+
137
+ // Tag page
138
+
139
+ // Get tag information
140
+ $term_id = get_query_var('tag_id');
141
+ $taxonomy = 'post_tag';
142
+ $args = 'include=' . $term_id;
143
+ $terms = get_terms( $taxonomy, $args );
144
+ $get_term_id = $terms[0]->term_id;
145
+ $get_term_slug = $terms[0]->slug;
146
+ $get_term_name = $terms[0]->name;
147
+
148
+ // Display the tag name
149
+ echo '<li class="item-current item-tag-' . $get_term_id . ' item-tag-' . $get_term_slug . '"><strong class="bread-current bread-tag-' . $get_term_id . ' bread-tag-' . $get_term_slug . '">' . $get_term_name . '</strong></li>';
150
+ } elseif ( is_day() ) {
151
+
152
+ // Day archive
153
+
154
+ // Year link
155
+ echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link( get_the_time('Y') ) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</a></li>';
156
+
157
+ // Month link
158
+ echo '<li class="item-month item-month-' . get_the_time('m') . '"><a class="bread-month bread-month-' . get_the_time('m') . '" href="' . get_month_link( get_the_time('Y'), get_the_time('m') ) . '" title="' . get_the_time('M') . '">' . get_the_time('M') . ' Archives</a></li>';
159
+
160
+
161
+ // Day display
162
+ echo '<li class="item-current item-' . get_the_time('j') . '"><strong class="bread-current bread-' . get_the_time('j') . '"> ' . get_the_time('jS') . ' ' . get_the_time('M') . ' Archives</strong></li>';
163
+
164
+ } else if ( is_month() ) {
165
+
166
+ // Month Archive
167
+
168
+ // Year link
169
+ echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link( get_the_time('Y') ) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</a></li>';
170
+
171
+ // Month display
172
+ echo '<li class="item-month item-month-' . get_the_time('m') . '"><strong class="bread-month bread-month-' . get_the_time('m') . '" title="' . get_the_time('M') . '">' . get_the_time('M') . ' Archives</strong></li>';
173
+
174
+ } else if ( is_year() ) {
175
+
176
+ // Display year archive
177
+ echo '<li class="item-current item-current-' . get_the_time('Y') . '"><strong class="bread-current bread-current-' . get_the_time('Y') . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</strong></li>';
178
+
179
+ } else if ( get_query_var('paged') ) {
180
+
181
+ // Paginated archives
182
+ echo '<li class="item-current item-current-' . get_query_var('paged') . '"><strong class="bread-current bread-current-' . get_query_var('paged') . '" title="Page ' . get_query_var('paged') . '">'.__('Page') . ' ' . get_query_var('paged') . '</strong></li>';
183
+
184
+ } else if ( is_search() ) {
185
+
186
+ // Search results page
187
+ echo '<li class="item-current item-current-' . get_search_query() . '"><strong class="bread-current bread-current-' . get_search_query() . '" title="Search results for: ' . get_search_query() . '">Search results for: ' . get_search_query() . '</strong></li>';
188
+
189
+ } elseif ( is_404() ) {
190
+
191
+ // 404 page
192
+ echo '<li>' . 'Error 404' . '</li>';
193
+ }
194
+ echo '</ul>';
195
+
196
+ }?>
197
+ </div>
templates/design-manager/design-3/functions.php CHANGED
@@ -126,9 +126,11 @@ function ampforwp_add_design3_required_scripts( $data ) {
126
  $amp_menu_has_child = get_transient( 'ampforwp_has_nav_child' );
127
 
128
  // Add Scripts only when AMP Menu is Enabled
129
- if( has_nav_menu( 'amp-menu' ) ) {
130
- if ( empty( $data['amp_component_scripts']['amp-accordion'] ) ) {
131
- $data['amp_component_scripts']['amp-accordion'] = 'https://cdn.ampproject.org/v0/amp-accordion-0.1.js';
 
 
132
  }
133
  }
134
  // Add Scripts only when Homepage AMP Featured Slider is Enabled
126
  $amp_menu_has_child = get_transient( 'ampforwp_has_nav_child' );
127
 
128
  // Add Scripts only when AMP Menu is Enabled
129
+ if(isset($redux_builder_amp['ampforwp-amp-menu']) && $redux_builder_amp['ampforwp-amp-menu']){
130
+ if( has_nav_menu( 'amp-menu' ) ) {
131
+ if ( empty( $data['amp_component_scripts']['amp-accordion'] ) ) {
132
+ $data['amp_component_scripts']['amp-accordion'] = 'https://cdn.ampproject.org/v0/amp-accordion-0.1.js';
133
+ }
134
  }
135
  }
136
  // Add Scripts only when Homepage AMP Featured Slider is Enabled
templates/design-manager/design-3/header-bar.php CHANGED
@@ -1,3 +1,5 @@
 
 
1
  <amp-sidebar id='sidebar'
2
  layout="nodisplay"
3
  side="left">
@@ -77,14 +79,16 @@
77
  </div>
78
  </div>
79
  </amp-sidebar>
80
-
81
  <div id="designthree" class="designthree main_container">
82
  <header class="container">
83
  <div id="headerwrap">
84
  <div id="header">
 
85
  <div class="hamburgermenu">
86
  <button class="toast pull-left" on='tap:sidebar.toggle'><span></span></button>
87
  </div>
 
88
  <div class="headerlogo">
89
  <?php global $redux_builder_amp;
90
  do_action('ampforwp_header_top_design3');
1
+ <?php global $redux_builder_amp;
2
+ if(isset($redux_builder_amp['ampforwp-amp-menu']) && $redux_builder_amp['ampforwp-amp-menu']){ ?>
3
  <amp-sidebar id='sidebar'
4
  layout="nodisplay"
5
  side="left">
79
  </div>
80
  </div>
81
  </amp-sidebar>
82
+ <?php } ?>
83
  <div id="designthree" class="designthree main_container">
84
  <header class="container">
85
  <div id="headerwrap">
86
  <div id="header">
87
+ <?php if(isset($redux_builder_amp['ampforwp-amp-menu']) && $redux_builder_amp['ampforwp-amp-menu']){ ?>
88
  <div class="hamburgermenu">
89
  <button class="toast pull-left" on='tap:sidebar.toggle'><span></span></button>
90
  </div>
91
+ <?php } ?>
92
  <div class="headerlogo">
93
  <?php global $redux_builder_amp;
94
  do_action('ampforwp_header_top_design3');
templates/design-manager/design-3/single.php CHANGED
@@ -18,6 +18,7 @@
18
  <main>
19
  <article class="amp-wp-article">
20
  <?php do_action('ampforwp_post_before_design_elements') ?>
 
21
 
22
  <?php $this->load_parts( apply_filters( 'ampforwp_design_elements', array( 'empty-filter' ) ) ); ?>
23
  <?php do_action('ampforwp_post_after_design_elements') ?>
18
  <main>
19
  <article class="amp-wp-article">
20
  <?php do_action('ampforwp_post_before_design_elements') ?>
21
+ <?php $this->load_parts( array( 'bread-crumbs' ) ); ?>
22
 
23
  <?php $this->load_parts( apply_filters( 'ampforwp_design_elements', array( 'empty-filter' ) ) ); ?>
24
  <?php do_action('ampforwp_post_after_design_elements') ?>
templates/design-manager/design-3/style.php CHANGED
@@ -406,5 +406,11 @@ if ( class_exists('TablePress') ) { ?>
406
  @media (min-width: 768px) and (max-width: 1600px){ .tablepress{ overflow-x: none; } }
407
  @media (min-width: 320px) and (max-width: 767px){ .tablepress{ display: inline-block; overflow-x: scroll; } }
408
  <?php } ?>
409
-
 
 
 
 
 
 
410
  <?php echo $redux_builder_amp['css_editor']; } ?>
406
  @media (min-width: 768px) and (max-width: 1600px){ .tablepress{ overflow-x: none; } }
407
  @media (min-width: 320px) and (max-width: 767px){ .tablepress{ display: inline-block; overflow-x: scroll; } }
408
  <?php } ?>
409
+ .breadcrumb{line-height: 1;margin-bottom:6px;}
410
+ .breadcrumb ul, .category-single ul{ padding:0; margin:0;}
411
+ .breadcrumb ul li{display:inline;}
412
+ .breadcrumb ul li a{ font-size:12px;}
413
+ .breadcrumb ul li a::after {content: "►";display: inline-block;font-size: 8px;padding: 0 6px 0 7px;vertical-align: middle;opacity: 0.5;position:relative;top:-1px}
414
+ .breadcrumb ul li:hover a::after{color:#c3c3c3;}
415
+ .breadcrumb ul li:last-child a::after{display:none;}
416
  <?php echo $redux_builder_amp['css_editor']; } ?>
templates/features.php CHANGED
@@ -211,21 +211,7 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
211
  } else {
212
  $supported_types = array('post','page');
213
 
214
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
215
- if( is_plugin_active( 'amp-custom-post-type/amp-custom-post-type.php' ) ) {
216
- if ( $redux_builder_amp['ampforwp-custom-type'] ) {
217
- foreach($redux_builder_amp['ampforwp-custom-type'] as $custom_post){
218
- $supported_types[] = $custom_post;
219
- }
220
- }
221
- }
222
-
223
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
224
- if( is_plugin_active( 'amp-woocommerce/amp-woocommerce.php' ) ) {
225
- if( !in_array("product", $supported_types) ){
226
- $supported_types[]= 'product';
227
- }
228
- }
229
 
230
  $type = get_post_type();
231
  $supported_amp_post_types = in_array( $type , $supported_types );
@@ -251,11 +237,11 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
251
  $current_search_url =trailingslashit(get_home_url())."?amp=1&s=".get_search_query();
252
  $amp_url = untrailingslashit($current_search_url);
253
  }
254
-
255
  $amp_url = apply_filters('ampforwp_modify_rel_canonical',$amp_url);
256
 
257
- if( $supported_amp_post_types) {
258
- printf( '<link rel="amphtml" href="%s" />', esc_url(trailingslashit($amp_url) ));
259
  }
260
 
261
  }
@@ -419,10 +405,11 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
419
  function ampforwp_add_amp_related_scripts( $data ) {
420
  global $redux_builder_amp;
421
  // Adding Sidebar Script
422
- if ( empty( $data['amp_component_scripts']['amp-sidebar'] ) ) {
423
- $data['amp_component_scripts']['amp-sidebar'] = 'https://cdn.ampproject.org/v0/amp-sidebar-0.1.js';
 
 
424
  }
425
-
426
  return $data;
427
  }
428
 
@@ -870,7 +857,7 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
870
  $content = preg_replace('/for=[^>]*/', '', $content);
871
  $content = preg_replace('/nowrap="nowrap"/', '', $content);
872
  $content = preg_replace('#<comments-count.*?>(.*?)</comments-count>#i', '', $content);
873
- $content = preg_replace('#<time.*?>(.*?)</time>#i', '', $content);
874
  $content = preg_replace('#<badge.*?>(.*?)</badge>#i', '', $content);
875
  $content = preg_replace('#<plusone.*?>(.*?)</plusone>#i', '', $content);
876
  $content = preg_replace('#<col.*?>#i', '', $content);
@@ -884,13 +871,13 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
884
  /* Removed So Inline style can work
885
  $content = preg_replace('/(<[^>]+) style=".*?"/', '$1', $content);
886
  */
887
- //$content = preg_replace('/(<[^>]+) rel=".*?"/', '$1', $content);
888
  $content = preg_replace('/<div(.*?) rel=".*?"(.*?)/', '<div $1', $content);
889
  $content = preg_replace('/(<[^>]+) ref=".*?"/', '$1', $content);
890
- $content = preg_replace('/(<[^>]+) date=".*?"/', '$1', $content);
891
  $content = preg_replace('/(<[^>]+) time=".*?"/', '$1', $content);
 
892
  $content = preg_replace('/(<[^>]+) imap=".*?"/', '$1', $content);
893
- $content = preg_replace('/(<[^>]+) date/', '$1', $content);
894
  $content = preg_replace('/(<[^>]+) spellcheck/', '$1', $content);
895
  $content = preg_replace('/<font(.*?)>(.*?)<\/font>/', '$2', $content);
896
 
@@ -900,7 +887,7 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
900
  $content = preg_replace('/<script[^>]*>.*?<\/script>/i', '', $content);
901
  /// simpy add more elements to simply strip tag but not the content as so
902
  /// Array ("p","font");
903
- $tags_to_strip = Array("thrive_headline","type","date","time","place","state","city" );
904
  $tags_to_strip = apply_filters('ampforwp_strip_bad_tags', $tags_to_strip);
905
  foreach ($tags_to_strip as $tag)
906
  {
@@ -2311,7 +2298,7 @@ function ampforwp_auto_add_amp_in_link_check() {
2311
 
2312
  function ampforwp_auto_add_amp_in_menu_link( $atts, $item, $args ) {
2313
 
2314
- $atts['href'] = trailingslashit(trailingslashit( $atts['href'] ) . AMPFORWP_AMP_QUERY_VAR);
2315
  return $atts;
2316
  }
2317
 
@@ -2630,13 +2617,15 @@ if ( ! function_exists( 'ampforwp_youtube_shortcode') ) {
2630
 
2631
  function ampforwp_youtube_shortcode( $params, $old_format_support = false ) {
2632
  $str = '';
2633
-
2634
  $youtube_url = 'https://www.youtube.com/watch?v=';
2635
- $parsed_url = parse_url( $params['id'] );
 
 
2636
  $server = 'www.youtube.com';
2637
 
2638
  if ( in_array( $server, $parsed_url ) === false ) {
2639
- if($params['id']){
2640
  $new_url = $youtube_url . $params['id'] ;
2641
  $params['id'] = $new_url;
2642
  }
@@ -2650,7 +2639,6 @@ if ( ! function_exists( 'ampforwp_youtube_shortcode') ) {
2650
  }
2651
  }
2652
  }
2653
-
2654
  return str_replace( array( '&amp;', '&#038;' ), '&', $str );
2655
  }
2656
  }
@@ -3007,6 +2995,26 @@ function ampforwp_remove_rel_on_bp(){
3007
 
3008
  }
3009
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3010
 
3011
  // 66. Make AMP compatible with Squirrly SEO
3012
  add_action('pre_amp_render_post','ampforwp_remove_sq_seo');
@@ -3029,7 +3037,14 @@ 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
@@ -3058,7 +3073,7 @@ function ampforwp_view_nonamp(){
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
@@ -3314,7 +3329,7 @@ function ampforwp_rel_canonical_home_archive(){
3314
  if ( $page >= '2') {
3315
  $amp_url = trailingslashit( $amp_url . '?page=' . $page);
3316
  } ?>
3317
- <link rel="canonical" href="<?php echo trailingslashit($amp_url) ?>">
3318
  <?php }
3319
 
3320
  }
@@ -3465,4 +3480,46 @@ function ampforwp_get_wp_user_avatar(){
3465
  return $user_avatar_url;
3466
  }
3467
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3468
  }
211
  } else {
212
  $supported_types = array('post','page');
213
 
214
+ $supported_types = apply_filters('get_amp_supported_post_types',$supported_types);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
 
216
  $type = get_post_type();
217
  $supported_amp_post_types = in_array( $type , $supported_types );
237
  $current_search_url =trailingslashit(get_home_url())."?amp=1&s=".get_search_query();
238
  $amp_url = untrailingslashit($current_search_url);
239
  }
240
+ $amp_url = user_trailingslashit($amp_url);
241
  $amp_url = apply_filters('ampforwp_modify_rel_canonical',$amp_url);
242
 
243
+ if( $supported_amp_post_types) {
244
+ printf('<link rel="amphtml" href="%s" />', esc_url($amp_url));
245
  }
246
 
247
  }
405
  function ampforwp_add_amp_related_scripts( $data ) {
406
  global $redux_builder_amp;
407
  // Adding Sidebar Script
408
+ if(isset($redux_builder_amp['ampforwp-amp-menu']) && $redux_builder_amp['ampforwp-amp-menu']){
409
+ if ( empty( $data['amp_component_scripts']['amp-sidebar'] ) ) {
410
+ $data['amp_component_scripts']['amp-sidebar'] = 'https://cdn.ampproject.org/v0/amp-sidebar-0.1.js';
411
+ }
412
  }
 
413
  return $data;
414
  }
415
 
857
  $content = preg_replace('/for=[^>]*/', '', $content);
858
  $content = preg_replace('/nowrap="nowrap"/', '', $content);
859
  $content = preg_replace('#<comments-count.*?>(.*?)</comments-count>#i', '', $content);
860
+ /*$content = preg_replace('#<time.*?>(.*?)</time>#i', '', $content);*/
861
  $content = preg_replace('#<badge.*?>(.*?)</badge>#i', '', $content);
862
  $content = preg_replace('#<plusone.*?>(.*?)</plusone>#i', '', $content);
863
  $content = preg_replace('#<col.*?>#i', '', $content);
871
  /* Removed So Inline style can work
872
  $content = preg_replace('/(<[^>]+) style=".*?"/', '$1', $content);
873
  */
874
+ $content = preg_replace('/(<[^>]+) rel="(.*?) noopener(.*?)"/', '$1 rel="$2$3"', $content);
875
  $content = preg_replace('/<div(.*?) rel=".*?"(.*?)/', '<div $1', $content);
876
  $content = preg_replace('/(<[^>]+) ref=".*?"/', '$1', $content);
877
+ /*$content = preg_replace('/(<[^>]+) date=".*?"/', '$1', $content);
878
  $content = preg_replace('/(<[^>]+) time=".*?"/', '$1', $content);
879
+ $content = preg_replace('/(<[^>]+) date/', '$1', $content);*/
880
  $content = preg_replace('/(<[^>]+) imap=".*?"/', '$1', $content);
 
881
  $content = preg_replace('/(<[^>]+) spellcheck/', '$1', $content);
882
  $content = preg_replace('/<font(.*?)>(.*?)<\/font>/', '$2', $content);
883
 
887
  $content = preg_replace('/<script[^>]*>.*?<\/script>/i', '', $content);
888
  /// simpy add more elements to simply strip tag but not the content as so
889
  /// Array ("p","font");
890
+ $tags_to_strip = Array("thrive_headline","type","place","state","city" );
891
  $tags_to_strip = apply_filters('ampforwp_strip_bad_tags', $tags_to_strip);
892
  foreach ($tags_to_strip as $tag)
893
  {
2298
 
2299
  function ampforwp_auto_add_amp_in_menu_link( $atts, $item, $args ) {
2300
 
2301
+ $atts['href'] = user_trailingslashit(trailingslashit( $atts['href'] ) . AMPFORWP_AMP_QUERY_VAR);
2302
  return $atts;
2303
  }
2304
 
2617
 
2618
  function ampforwp_youtube_shortcode( $params, $old_format_support = false ) {
2619
  $str = '';
2620
+ $parsed_url = array();
2621
  $youtube_url = 'https://www.youtube.com/watch?v=';
2622
+ if(isset( $params['id']) ){
2623
+ $parsed_url = parse_url( $params['id'] );
2624
+ }
2625
  $server = 'www.youtube.com';
2626
 
2627
  if ( in_array( $server, $parsed_url ) === false ) {
2628
+ if(isset($params['id']) && $params['id']){
2629
  $new_url = $youtube_url . $params['id'] ;
2630
  $params['id'] = $new_url;
2631
  }
2639
  }
2640
  }
2641
  }
 
2642
  return str_replace( array( '&amp;', '&#038;' ), '&', $str );
2643
  }
2644
  }
2995
 
2996
  }
2997
 
2998
+ // Removing AMP from WPForo Forums Pages #592
2999
+
3000
+ add_action('amp_init','remove_rel_amp_from_forum');
3001
+ function remove_rel_amp_from_forum(){
3002
+ add_action('wp','ampforwp_remove_rel_on_forum');
3003
+ }
3004
+
3005
+ function ampforwp_remove_rel_on_forum(){
3006
+ if(class_exists('wpForo')){
3007
+ Global $post, $wpdb,$wpforo;
3008
+ $foid = $post->ID;
3009
+ $fid = $wpforo->pageid;
3010
+ if($foid==$fid){
3011
+ remove_action( 'wp_head', 'amp_frontend_add_canonical');
3012
+ remove_action( 'wp_head', 'ampforwp_home_archive_rel_canonical' );
3013
+ }
3014
+
3015
+ }
3016
+ }
3017
+
3018
 
3019
  // 66. Make AMP compatible with Squirrly SEO
3020
  add_action('pre_amp_render_post','ampforwp_remove_sq_seo');
3037
  global $redux_builder_amp;
3038
  global $post;
3039
  $ampforwp_backto_nonamp = '';
3040
+ if ( is_home() && get_option( 'page_for_posts' ) && get_queried_object_id() ) {
3041
+ $post_id = get_option('page_for_posts');
3042
+ if($redux_builder_amp['amp-mobile-redirection']==1)
3043
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post_id )).'?nonamp=1';
3044
+ else
3045
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post_id ));
3046
+ }
3047
+ elseif ( is_home() ) {
3048
  if($redux_builder_amp['amp-mobile-redirection']==1)
3049
  $ampforwp_backto_nonamp = trailingslashit(home_url()).'?nonamp=1' ;
3050
  else
3073
  $ampforwp_backto_nonamp = preg_replace('/amp/','',$ampforwp_backto_nonamp);
3074
  }
3075
  } ?>
3076
+ <?php if ( $ampforwp_backto_nonamp ) { ?> <a class="view-non-amp" href="<?php echo $ampforwp_backto_nonamp; ?>" rel="nofollow"><?php echo esc_html( $redux_builder_amp['amp-translator-non-amp-page-text'] ) ;?> </a> <?php }
3077
  }
3078
 
3079
  //68. Facebook Instant Articles
3329
  if ( $page >= '2') {
3330
  $amp_url = trailingslashit( $amp_url . '?page=' . $page);
3331
  } ?>
3332
+ <link rel="canonical" href="<?php echo user_trailingslashit($amp_url) ?>">
3333
  <?php }
3334
 
3335
  }
3480
  return $user_avatar_url;
3481
  }
3482
  }
3483
+ }
3484
+ add_filter('get_amp_supported_post_types','ampforwp_supported_post_types');
3485
+ function ampforwp_supported_post_types($supported_types){
3486
+ global $redux_builder_amp;
3487
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
3488
+ if( is_plugin_active( 'amp-custom-post-type/amp-custom-post-type.php' ) ) {
3489
+ if ( $redux_builder_amp['ampforwp-custom-type'] ) {
3490
+ foreach($redux_builder_amp['ampforwp-custom-type'] as $custom_post){
3491
+ $supported_types[] = $custom_post;
3492
+ }
3493
+ }
3494
+ }
3495
+ if( is_plugin_active( 'amp-woocommerce/amp-woocommerce.php' ) ) {
3496
+ if( !in_array("product", $supported_types) ){
3497
+ $supported_types[]= 'product';
3498
+ }
3499
+ }
3500
+ return $supported_types;
3501
+ }
3502
+
3503
+ function is_category_amp_disabled(){
3504
+ global $redux_builder_amp;
3505
+
3506
+ if(is_archive() && $redux_builder_amp['ampforwp-archive-support']==1){
3507
+ $categories = get_the_category();
3508
+ $category_id = $categories[0]->cat_ID;
3509
+ $get_categories_from_checkbox = $redux_builder_amp['hide-amp-categories'];
3510
+ // Check if $get_categories_from_checkbox has some cats then only show
3511
+ if ( $get_categories_from_checkbox ) {
3512
+ $get_selected_cats = array_filter($get_categories_from_checkbox);
3513
+ foreach ($get_selected_cats as $key => $value) {
3514
+ $selected_cats[] = $key;
3515
+ }
3516
+ if($selected_cats && $category_id){
3517
+ if(in_array($category_id, $selected_cats)){
3518
+ return true;
3519
+ }
3520
+ else
3521
+ return false;
3522
+ }
3523
+ }
3524
+ }
3525
  }
templates/instant-articles/instant-article.php CHANGED
@@ -5,23 +5,23 @@
5
  <meta charset="utf-8">
6
  <link rel="canonical" href="<?php the_permalink(); ?>">
7
  <meta property="op:markup_version" content="v1.0">
8
- <?php if ( $redux_builder_amp['fb-instant-article-ads'] ){ ?>
9
  <!-- automatic ad placement -->
10
- <meta property="fb:use_automatic_ad_placement" content="true">
11
  <?php } ?>
12
  </head>
13
  <body>
14
  <article>
15
  <header>
16
-
17
- <!-- Analytics code -->
18
- <?php if ( $redux_builder_amp['fb-instant-article-analytics'] ){ ?>
19
- <figure class="op-tracker">
20
- <iframe>
21
- <?php echo get_ia_analytics_code(); ?>
22
- </iframe>
23
- </figure>
24
- <?php } ?>
25
  <!-- title -->
26
  <h1><?php the_title(); ?></h1>
27
 
@@ -61,12 +61,13 @@
61
  endif; ?>
62
  </figure>
63
  <?php endif; ?>
64
- <?php if ( $redux_builder_amp['fb-instant-article-ads'] ){ ?>
65
- <!-- facebook audience network ad -->
66
- <figure class="op-ad">
67
- <iframe width="300" height="250" style="border:0; margin:0;" src="https://www.facebook.com/adnw_request?placement=<?php echo get_ia_placement_id(); ?>&adtype=banner300x250"></iframe>
68
- </figure>
69
- <?php } ?>
 
70
  </header>
71
 
72
  <!-- body -->
5
  <meta charset="utf-8">
6
  <link rel="canonical" href="<?php the_permalink(); ?>">
7
  <meta property="op:markup_version" content="v1.0">
8
+ <?php if (isset($redux_builder_amp['fb-instant-article-ads']) && $redux_builder_amp['fb-instant-article-ads'] ){ ?>
9
  <!-- automatic ad placement -->
10
+ <meta property="fb:use_automatic_ad_placement" content="enable=true ad_density=default">
11
  <?php } ?>
12
  </head>
13
  <body>
14
  <article>
15
  <header>
16
+ <?php if (isset($redux_builder_amp['fb-instant-article-analytics']) && $redux_builder_amp['fb-instant-article-analytics'] ){
17
+ if(isset($redux_builder_amp['fb-instant-article-analytics-code']) && $redux_builder_amp['fb-instant-article-analytics-code'] ) {?>
18
+ <!-- Analytics code -->
19
+ <figure class="op-tracker">
20
+ <iframe>
21
+ <?php echo get_ia_analytics_code(); ?>
22
+ </iframe>
23
+ </figure>
24
+ <?php } } ?>
25
  <!-- title -->
26
  <h1><?php the_title(); ?></h1>
27
 
61
  endif; ?>
62
  </figure>
63
  <?php endif; ?>
64
+ <?php if (isset($redux_builder_amp['fb-instant-article-ads']) && $redux_builder_amp['fb-instant-article-ads'] ){
65
+ if(isset($redux_builder_amp['fb-instant-article-ad-id']) && $redux_builder_amp['fb-instant-article-ad-id']){ ?>
66
+ <!-- facebook audience network ad -->
67
+ <figure class="op-ad">
68
+ <iframe width="300" height="250" style="border:0; margin:0;" src="https://www.facebook.com/adnw_request?placement=<?php echo get_ia_placement_id(); ?>&adtype=banner300x250"></iframe>
69
+ </figure>
70
+ <?php } } ?>
71
  </header>
72
 
73
  <!-- body -->