Version Description
(23rd May 2019) = * Fixed: HUGE PERFORMANCE Issues #3052 * Fixed: Performance Issue with queries #2997 * Fixed: Performance Issues with template_redirect hooks #2773 #2920 * Fixed: Performance Issues with Design manager #2873 * Fixed: Performance Issues with ampforwp_exclude_post option #3118 * Fixed: Performance Issues with AMP Pagebuilder modules and settings which were loading By default #2323 * Fixed: Performance Issues with Hide AMP Bulk Tools #2549
Full changelog available in changelog.txt
Download this release
Release Info
Developer | mohammed_kaludi |
Plugin | AMP for WP – Accelerated Mobile Pages |
Version | 0.9.97.54 |
Comparing to | |
See all releases |
Code changes from version 0.9.97.53 to 0.9.97.54
- README.md +10 -1
- accelerated-moblie-pages.php +25 -5
- changelog.txt +9 -0
- classes/class-ampforwp-infinite-scroll.php +1 -1
- classes/class-init.php +0 -1
- components/components-core.php +20 -8
- components/loop/loop.php +8 -6
- components/menu/menu.php +47 -34
- includes/features/functions.php +51 -0
- includes/features/structure-data/structured-data-functions.php +31 -19
- includes/options/admin-config.php +17 -21
- includes/options/redux-core/framework.php +3 -2
- includes/options/redux-core/inc/fields/select/field_select.php +1 -1
- includes/redirect.php +98 -160
- includes/vendor/amp/amp.php +4 -0
- pagebuilder/functions.php +3 -30
- pagebuilder/modules/contents-module.php +2 -1
- readme.txt +8 -9
- templates/category-widget.php +3 -2
- templates/design-manager/design-1/footer.php +8 -11
- templates/design-manager/design-1/header-bar.php +10 -16
- templates/design-manager/design-1/index.php +1 -1
- templates/design-manager/design-1/search.php +1 -1
- templates/design-manager/design-2/footer.php +8 -11
- templates/design-manager/design-2/header-bar.php +10 -15
- templates/design-manager/design-2/index.php +1 -1
- templates/design-manager/design-2/search.php +1 -1
- templates/design-manager/design-3/archive.php +1 -1
- templates/design-manager/design-3/footer.php +7 -13
- templates/design-manager/design-3/header-bar.php +10 -15
- templates/design-manager/design-3/index.php +1 -1
- templates/design-manager/design-3/search.php +1 -1
- templates/design-manager/swift/footer.php +4 -7
- templates/features.php +74 -224
- templates/woo-widget.php +1 -2
README.md
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/25
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 5.2
|
7 |
-
Stable tag: 0.9.97.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -192,6 +192,15 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
|
|
192 |
|
193 |
== Changelog ==
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
= 0.9.97.53 (20th May 2019) =
|
196 |
* Fixed: 500 errors on posts that don't use WP Bakery #3183
|
197 |
* Fixed: Hyperlink in amp pages including emoji - code improved #2967
|
4 |
Donate link: https://www.paypal.me/Kaludi/25
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 5.2
|
7 |
+
Stable tag: 0.9.97.54
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
192 |
|
193 |
== Changelog ==
|
194 |
|
195 |
+
= 0.9.97.54 (23rd May 2019) =
|
196 |
+
* Fixed: HUGE PERFORMANCE Issues #3052
|
197 |
+
* Fixed: Performance Issue with queries #2997
|
198 |
+
* Fixed: Performance Issues with template_redirect hooks #2773 #2920
|
199 |
+
* Fixed: Performance Issues with Design manager #2873
|
200 |
+
* Fixed: Performance Issues with ampforwp_exclude_post option #3118
|
201 |
+
* Fixed: Performance Issues with AMP Pagebuilder modules and settings which were loading By default #2323
|
202 |
+
* Fixed: Performance Issues with Hide AMP Bulk Tools #2549
|
203 |
+
|
204 |
= 0.9.97.53 (20th May 2019) =
|
205 |
* Fixed: 500 errors on posts that don't use WP Bakery #3183
|
206 |
* Fixed: Hyperlink in amp pages including emoji - code improved #2967
|
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.97.
|
7 |
Author: Ahmed Kaludi, Mohammed Kaludi
|
8 |
Author URI: https://ampforwp.com/
|
9 |
Donate link: https://www.paypal.me/Kaludi/25
|
@@ -20,7 +20,7 @@ define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
|
|
20 |
define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
|
21 |
define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
|
22 |
define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
|
23 |
-
define('AMPFORWP_VERSION','0.9.97.
|
24 |
define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
|
25 |
// any changes to AMP_QUERY_VAR should be refelected here
|
26 |
function ampforwp_generate_endpoint(){
|
@@ -510,7 +510,7 @@ if ( ! class_exists( 'Ampforwp_Init', false ) ) {
|
|
510 |
|
511 |
require AMPFORWP_PLUGIN_DIR .'/includes/features/functions.php';
|
512 |
// Load Files required for the plugin to run
|
513 |
-
if(
|
514 |
require_once AMPFORWP_PLUGIN_DIR."includes/features/amp_bridge.php";
|
515 |
}
|
516 |
else{
|
@@ -718,10 +718,12 @@ if ( ! defined('AMP_FRAMEWORK_COMOPNENT_DIR_PATH') ) {
|
|
718 |
}
|
719 |
require_once( AMP_FRAMEWORK_COMOPNENT_DIR_PATH . '/components-core.php' );
|
720 |
require ( AMPFORWP_PLUGIN_DIR.'/install/index.php' );
|
721 |
-
if ( !
|
722 |
require_once( AMPFORWP_PLUGIN_DIR. 'base_remover/base_remover.php' );
|
723 |
require_once( AMPFORWP_PLUGIN_DIR. 'includes/thirdparty-compatibility.php' );
|
724 |
-
|
|
|
|
|
725 |
}
|
726 |
if(is_admin()){
|
727 |
require_once( AMPFORWP_PLUGIN_DIR. 'includes/modules-upgrade.php' );
|
@@ -1022,4 +1024,22 @@ function ampforwp_vendor_is_amp_endpoint(){
|
|
1022 |
return false !== get_query_var( AMP_QUERY_VAR, false );
|
1023 |
}
|
1024 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1025 |
}
|
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.97.54
|
7 |
Author: Ahmed Kaludi, Mohammed Kaludi
|
8 |
Author URI: https://ampforwp.com/
|
9 |
Donate link: https://www.paypal.me/Kaludi/25
|
20 |
define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
|
21 |
define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
|
22 |
define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
|
23 |
+
define('AMPFORWP_VERSION','0.9.97.54');
|
24 |
define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
|
25 |
// any changes to AMP_QUERY_VAR should be refelected here
|
26 |
function ampforwp_generate_endpoint(){
|
510 |
|
511 |
require AMPFORWP_PLUGIN_DIR .'/includes/features/functions.php';
|
512 |
// Load Files required for the plugin to run
|
513 |
+
if( function_exists('amp_activate') ){
|
514 |
require_once AMPFORWP_PLUGIN_DIR."includes/features/amp_bridge.php";
|
515 |
}
|
516 |
else{
|
718 |
}
|
719 |
require_once( AMP_FRAMEWORK_COMOPNENT_DIR_PATH . '/components-core.php' );
|
720 |
require ( AMPFORWP_PLUGIN_DIR.'/install/index.php' );
|
721 |
+
if ( !function_exists('amp_activate') ) {
|
722 |
require_once( AMPFORWP_PLUGIN_DIR. 'base_remover/base_remover.php' );
|
723 |
require_once( AMPFORWP_PLUGIN_DIR. 'includes/thirdparty-compatibility.php' );
|
724 |
+
if ( ampforwp_get_setting('ampforwp-pagebuilder') ){
|
725 |
+
require_once( AMPFORWP_PLUGIN_DIR. 'pagebuilder/amp-page-builder.php');
|
726 |
+
}
|
727 |
}
|
728 |
if(is_admin()){
|
729 |
require_once( AMPFORWP_PLUGIN_DIR. 'includes/modules-upgrade.php' );
|
1024 |
return false !== get_query_var( AMP_QUERY_VAR, false );
|
1025 |
}
|
1026 |
}
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
// ampforwp_exclude_posts function #3118
|
1030 |
+
if ( ! function_exists('ampforwp_exclude_posts') ) {
|
1031 |
+
function ampforwp_exclude_posts(){
|
1032 |
+
$exclude_post_values = array();
|
1033 |
+
$ampforwp_exclude_post_transient = get_transient('ampforwp_exclude_post_transient');
|
1034 |
+
if ( false != $ampforwp_exclude_post_transient ) {
|
1035 |
+
$exclude_post_values = $ampforwp_exclude_post_transient;
|
1036 |
+
}
|
1037 |
+
else{
|
1038 |
+
$ampforwp_exclude_post = get_option('ampforwp_exclude_post');
|
1039 |
+
if ( false != $ampforwp_exclude_post ) {
|
1040 |
+
$exclude_post_values = $ampforwp_exclude_post;
|
1041 |
+
}
|
1042 |
+
}
|
1043 |
+
return $exclude_post_values;
|
1044 |
+
}
|
1045 |
}
|
changelog.txt
CHANGED
@@ -1,5 +1,14 @@
|
|
1 |
== Changelog ==
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
= 0.9.97.53 (20th May 2019) =
|
4 |
* Fixed: 500 errors on posts that don't use WP Bakery #3183
|
5 |
* Fixed: Hyperlink in amp pages including emoji - code improved #2967
|
1 |
== Changelog ==
|
2 |
|
3 |
+
= 0.9.97.54 (23rd May 2019) =
|
4 |
+
* Fixed: HUGE PERFORMANCE Issues #3052
|
5 |
+
* Fixed: Performance Issues with queries #2997
|
6 |
+
* Fixed: Performance Issues with template_redirect hooks #2773 #2920
|
7 |
+
* Fixed: Performance Issues with Design manager #2873
|
8 |
+
* Fixed: Performance Issues with ampforwp_exclude_post option #3118
|
9 |
+
* Fixed: Performance Issues with AMP Pagebuilder modules and settings which were loading By default #2323
|
10 |
+
* Fixed: Performance Issues with Hide AMP Bulk Tools #2549
|
11 |
+
|
12 |
= 0.9.97.53 (20th May 2019) =
|
13 |
* Fixed: 500 errors on posts that don't use WP Bakery #3183
|
14 |
* Fixed: Hyperlink in amp pages including emoji - code improved #2967
|
classes/class-ampforwp-infinite-scroll.php
CHANGED
@@ -102,7 +102,7 @@ if( ! class_exists('AMPforWP_Infinite_Scroll') ) {
|
|
102 |
public function single_post() {
|
103 |
global $post;
|
104 |
$pages = array();
|
105 |
-
$exclude_ids =
|
106 |
$exclude_ids[] = $post->ID;
|
107 |
$query_args = array(
|
108 |
'post_type' => get_post_type(),
|
102 |
public function single_post() {
|
103 |
global $post;
|
104 |
$pages = array();
|
105 |
+
$exclude_ids = ampforwp_exclude_posts();
|
106 |
$exclude_ids[] = $post->ID;
|
107 |
$query_args = array(
|
108 |
'post_type' => get_post_type(),
|
classes/class-init.php
CHANGED
@@ -11,7 +11,6 @@ if ( ! class_exists( 'Ampforwp_Loader', false ) ) {
|
|
11 |
}
|
12 |
public function load_required_files() {
|
13 |
require AMPFORWP_PLUGIN_DIR . '/templates/features.php';
|
14 |
-
require AMPFORWP_PLUGIN_DIR . '/templates/instant-articles/instant-article-sanitizer.php';
|
15 |
}
|
16 |
}
|
17 |
} ?>
|
11 |
}
|
12 |
public function load_required_files() {
|
13 |
require AMPFORWP_PLUGIN_DIR . '/templates/features.php';
|
|
|
14 |
}
|
15 |
}
|
16 |
} ?>
|
components/components-core.php
CHANGED
@@ -151,16 +151,28 @@ function amp_excerpt( $no_of_words=15 ) {
|
|
151 |
|
152 |
|
153 |
//Menus
|
154 |
-
function amp_menu($echo=true){
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
162 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
}
|
|
|
164 |
|
165 |
// Social Icons component
|
166 |
function amp_social( $social_icons="" ) {
|
151 |
|
152 |
|
153 |
//Menus
|
154 |
+
function amp_menu($echo=true, $menu_args=array(), $type='header'){
|
155 |
+
if ( ($type == 'header' && ! has_nav_menu( 'amp-menu' )) || ( 'footer' == $type && ! has_nav_menu( 'amp-footer-menu' ) ) ) {
|
156 |
+
return false;
|
157 |
+
}
|
158 |
+
global $loadComponent;
|
159 |
+
if(isset($loadComponent['AMP-menu']) && $loadComponent['AMP-menu']==true){
|
160 |
+
if ( false != get_transient('ampforwp_header_menu') && 'header' == $type ){
|
161 |
+
$amp_menu = get_transient('ampforwp_header_menu');
|
162 |
+
}
|
163 |
+
elseif (false != get_transient('ampforwp_footer_menu') && 'footer' == $type) {
|
164 |
+
$amp_menu = get_transient('ampforwp_footer_menu');
|
165 |
}
|
166 |
+
else{
|
167 |
+
$amp_menu = amp_menu_html($echo, $menu_args, $type);
|
168 |
+
}
|
169 |
+
if ( false == $echo ) {
|
170 |
+
return $amp_menu;
|
171 |
+
}
|
172 |
+
else
|
173 |
+
echo $amp_menu;
|
174 |
}
|
175 |
+
}
|
176 |
|
177 |
// Social Icons component
|
178 |
function amp_social( $social_icons="" ) {
|
components/loop/loop.php
CHANGED
@@ -85,10 +85,11 @@ function call_loops_standard($data=array()){
|
|
85 |
$qobj_taxonomy = $qobj_term_id = "";
|
86 |
|
87 |
if ( is_archive() ) {
|
88 |
-
$exclude_ids =
|
89 |
$qobj = get_queried_object();
|
90 |
if( !is_date() ){
|
91 |
$args = array(
|
|
|
92 |
'post_type' => $post_type,
|
93 |
'orderby' => 'date',
|
94 |
'ignore_sticky_posts' => 1,
|
@@ -126,9 +127,9 @@ function call_loops_standard($data=array()){
|
|
126 |
}
|
127 |
}
|
128 |
if ( is_home() ) {
|
129 |
-
$exclude_ids =
|
130 |
-
|
131 |
$args = array(
|
|
|
132 |
'post_type' => 'post',
|
133 |
'orderby' => 'date',
|
134 |
'paged' => esc_attr($paged),
|
@@ -139,7 +140,7 @@ function call_loops_standard($data=array()){
|
|
139 |
}
|
140 |
|
141 |
if ( is_search() ) {
|
142 |
-
$exclude_ids =
|
143 |
$args = array(
|
144 |
's' => get_search_query() ,
|
145 |
'ignore_sticky_posts' => 1,
|
@@ -150,7 +151,7 @@ function call_loops_standard($data=array()){
|
|
150 |
);
|
151 |
}
|
152 |
if(is_author()){
|
153 |
-
$exclude_ids =
|
154 |
$author = get_user_by( 'slug', get_query_var( 'author_name' ) );
|
155 |
$args = array(
|
156 |
'author' => $author->ID,
|
@@ -165,9 +166,10 @@ function call_loops_standard($data=array()){
|
|
165 |
}
|
166 |
if( is_single() ) {
|
167 |
global $post;
|
168 |
-
$exclude_ids =
|
169 |
$exclude_ids[] = $post->ID;
|
170 |
$args = array(
|
|
|
171 |
'post_type' => 'post',
|
172 |
'orderby' => 'date',
|
173 |
'ignore_sticky_posts' => 1,
|
85 |
$qobj_taxonomy = $qobj_term_id = "";
|
86 |
|
87 |
if ( is_archive() ) {
|
88 |
+
$exclude_ids = ampforwp_exclude_posts();
|
89 |
$qobj = get_queried_object();
|
90 |
if( !is_date() ){
|
91 |
$args = array(
|
92 |
+
'no_found_rows' => true,
|
93 |
'post_type' => $post_type,
|
94 |
'orderby' => 'date',
|
95 |
'ignore_sticky_posts' => 1,
|
127 |
}
|
128 |
}
|
129 |
if ( is_home() ) {
|
130 |
+
$exclude_ids = ampforwp_exclude_posts();
|
|
|
131 |
$args = array(
|
132 |
+
'no_found_rows' => true,
|
133 |
'post_type' => 'post',
|
134 |
'orderby' => 'date',
|
135 |
'paged' => esc_attr($paged),
|
140 |
}
|
141 |
|
142 |
if ( is_search() ) {
|
143 |
+
$exclude_ids = ampforwp_exclude_posts();
|
144 |
$args = array(
|
145 |
's' => get_search_query() ,
|
146 |
'ignore_sticky_posts' => 1,
|
151 |
);
|
152 |
}
|
153 |
if(is_author()){
|
154 |
+
$exclude_ids = ampforwp_exclude_posts();
|
155 |
$author = get_user_by( 'slug', get_query_var( 'author_name' ) );
|
156 |
$args = array(
|
157 |
'author' => $author->ID,
|
166 |
}
|
167 |
if( is_single() ) {
|
168 |
global $post;
|
169 |
+
$exclude_ids = ampforwp_exclude_posts();
|
170 |
$exclude_ids[] = $post->ID;
|
171 |
$args = array(
|
172 |
+
'no_found_rows' => true,
|
173 |
'post_type' => 'post',
|
174 |
'orderby' => 'date',
|
175 |
'ignore_sticky_posts' => 1,
|
components/menu/menu.php
CHANGED
@@ -1,19 +1,31 @@
|
|
1 |
<?php
|
2 |
require_once AMPFORWP_PLUGIN_DIR .'/classes/class-ampforwp-walker-nav-menu.php';
|
3 |
|
4 |
-
function amp_menu_html($echo){
|
5 |
-
if( has_nav_menu( 'amp-menu' ) ) {
|
6 |
-
|
|
|
|
|
|
|
|
|
7 |
'theme_location' => 'amp-menu',
|
8 |
'container'=>'aside',
|
9 |
'menu'=>'ul',
|
10 |
'menu_class'=>'amp-menu',
|
11 |
'echo' => false,
|
12 |
'walker' => new Ampforwp_Walker_Nav_Menu()
|
13 |
-
)
|
|
|
|
|
14 |
$menu_html_content = apply_filters('ampforwp_menu_content', $menu_html_content);
|
15 |
$sanitizer_obj = new AMPFORWP_Content( $menu_html_content, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
|
16 |
$sanitized_menu = $sanitizer_obj->get_amp_content();
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
return $sanitized_menu;
|
18 |
}
|
19 |
}
|
@@ -23,36 +35,37 @@ add_action('amp_post_template_css','amp_menu_styles',11);
|
|
23 |
function amp_menu_styles(){
|
24 |
$atf = '';
|
25 |
$design = ampforwp_get_setting('amp-design-selector');
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
58 |
}
|
1 |
<?php
|
2 |
require_once AMPFORWP_PLUGIN_DIR .'/classes/class-ampforwp-walker-nav-menu.php';
|
3 |
|
4 |
+
function amp_menu_html($echo, $menu_args, $type){
|
5 |
+
if( has_nav_menu( 'amp-menu' ) || has_nav_menu( 'amp-footer-menu' ) ) {
|
6 |
+
if ( !empty($menu_args) && isset($menu_args['walker']) ) {
|
7 |
+
$menu_args['walker'] = new Ampforwp_Walker_Nav_Menu();
|
8 |
+
}
|
9 |
+
if (empty($menu_args)){
|
10 |
+
$menu_args = array(
|
11 |
'theme_location' => 'amp-menu',
|
12 |
'container'=>'aside',
|
13 |
'menu'=>'ul',
|
14 |
'menu_class'=>'amp-menu',
|
15 |
'echo' => false,
|
16 |
'walker' => new Ampforwp_Walker_Nav_Menu()
|
17 |
+
);
|
18 |
+
}
|
19 |
+
$menu_html_content = wp_nav_menu( $menu_args );
|
20 |
$menu_html_content = apply_filters('ampforwp_menu_content', $menu_html_content);
|
21 |
$sanitizer_obj = new AMPFORWP_Content( $menu_html_content, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
|
22 |
$sanitized_menu = $sanitizer_obj->get_amp_content();
|
23 |
+
if ( 'header' == $type ) {
|
24 |
+
set_transient('ampforwp_header_menu', $sanitized_menu, 24*HOUR_IN_SECONDS );
|
25 |
+
}
|
26 |
+
elseif ('footer' == $type) {
|
27 |
+
set_transient('ampforwp_footer_menu', $sanitized_menu, 24*HOUR_IN_SECONDS );
|
28 |
+
}
|
29 |
return $sanitized_menu;
|
30 |
}
|
31 |
}
|
35 |
function amp_menu_styles(){
|
36 |
$atf = '';
|
37 |
$design = ampforwp_get_setting('amp-design-selector');
|
38 |
+
if ( $design != 1 && $design != 2 && $design != 3 ) {
|
39 |
+
$atf = true;?>
|
40 |
+
.amp-menu input{display:none;}
|
41 |
+
|
42 |
+
<?php
|
43 |
+
|
44 |
+
if ( ! defined('AMPFORWP_LAYOUTS_URL') ) { ?>
|
45 |
+
/** Dropdown CSS **/
|
46 |
+
amp-sidebar{padding:15px;}
|
47 |
+
.amp-sidebar-close{border-radius: 100%;cursor:pointer;}
|
48 |
+
.amp-search-wrapper{margin-bottom:15px;}
|
49 |
+
.amp-menu li.menu-item-has-children ul{display:none;margin:0;}
|
50 |
+
.amp-menu li.menu-item-has-children ul, .amp-menu li.menu-item-has-children ul ul{font-size:14px;}
|
51 |
+
.amp-menu input{display:none;}
|
52 |
+
.amp-menu [id^=drop]:checked + label + ul{ display: block;}
|
53 |
+
.amp-menu .toggle:after{content:'\25be';position:absolute;padding: 10px 15px 10px 30px;right:0;font-size:18px;color:#ed1c24;top:0px;z-index:10000;line-height:1;cursor:pointer;}
|
54 |
+
<?php
|
55 |
+
} elseif( $atf && defined('AMPFORWP_LAYOUTS_URL') ){?>
|
56 |
|
57 |
+
/** Dropdown CSS **/
|
58 |
+
amp-sidebar{padding:15px;}
|
59 |
+
.amp-sidebar-close{border-radius: 100%;cursor:pointer;}
|
60 |
+
.amp-search-wrapper{margin-bottom:15px;}
|
61 |
+
.amp-menu li.menu-item-has-children ul{display:none;margin:0;}
|
62 |
+
.amp-menu li.menu-item-has-children ul, .amp-menu li.menu-item-has-children ul ul{font-size:14px;}
|
63 |
+
.amp-menu input{display:none;}
|
64 |
+
.amp-menu [id^=drop]:checked + label + ul{ display: block;}
|
65 |
|
66 |
+
<?php
|
67 |
+
}?>
|
68 |
+
<?php /*AMP theme framework and AMP layouts and this is required*/ ?>
|
69 |
+
aside{width:150px}.amp-menu{list-style-type:none;margin:0;padding:0}.amp-menu li{position:relative;display:block}.amp-menu li.menu-item-has-children ul{display:none}.amp-menu li.menu-item-has-children:hover>ul{display:}.amp-menu li.menu-item-has-children>ul>li{padding-left:10px}.amp-menu>li a{padding:7px;display:block;margin-bottom:1px}.amp-menu>li ul{list-style-type:none;margin:0;padding:0;position:relative}.amp-menu input{display:none;}<?php
|
70 |
+
}
|
71 |
}
|
includes/features/functions.php
CHANGED
@@ -732,6 +732,34 @@ if(!function_exists('ampforwp_amp_nonamp_convert')){
|
|
732 |
return $returnData;
|
733 |
}
|
734 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
735 |
// Protocol Remover
|
736 |
if ( ! function_exists('ampforwp_remove_protocol') ) {
|
737 |
function ampforwp_remove_protocol($url){
|
@@ -748,4 +776,27 @@ if ( ! function_exists('ampforwp_sanitize_i_amphtml') ) {
|
|
748 |
$data = preg_replace_callback('/.i-amphtml-(.*?){(.*?)}/s',function($matches){ if(!empty($matched)){ return ''; } }, $data);
|
749 |
return $data;
|
750 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
751 |
}
|
732 |
return $returnData;
|
733 |
}
|
734 |
}
|
735 |
+
|
736 |
+
// wp_update_nav_menu #3052
|
737 |
+
add_action('wp_update_nav_menu', 'ampforwp_wp_update_nav_menu', 10 , 1 );
|
738 |
+
if ( ! function_exists('ampforwp_wp_update_nav_menu') ) {
|
739 |
+
function ampforwp_wp_update_nav_menu( $menu_id ) {
|
740 |
+
if ( false != get_transient('ampforwp_header_menu') ) {
|
741 |
+
delete_transient('ampforwp_header_menu');
|
742 |
+
}
|
743 |
+
if ( false != get_transient('ampforwp_footer_menu') ) {
|
744 |
+
delete_transient('ampforwp_footer_menu');
|
745 |
+
}
|
746 |
+
}
|
747 |
+
}
|
748 |
+
// Delete Menu Transients on Saving AMP Settings #3052
|
749 |
+
if ( function_exists('ampforwp_menu_transient_on_save') ){
|
750 |
+
function ampforwp_menu_transient_on_save($redux_builder_amp, $this_transients_changed_values) {
|
751 |
+
if ( isset($this_transients_changed_values['amp-design-selector']) ) {
|
752 |
+
if ( false != get_transient('ampforwp_header_menu') ) {
|
753 |
+
delete_transient('ampforwp_header_menu');
|
754 |
+
}
|
755 |
+
if ( false != get_transient('ampforwp_footer_menu') ) {
|
756 |
+
delete_transient('ampforwp_footer_menu');
|
757 |
+
}
|
758 |
+
}
|
759 |
+
}
|
760 |
+
}
|
761 |
+
add_action("redux/options/redux_builder_amp/saved",'ampforwp_menu_transient_on_save', 10, 2);
|
762 |
+
|
763 |
// Protocol Remover
|
764 |
if ( ! function_exists('ampforwp_remove_protocol') ) {
|
765 |
function ampforwp_remove_protocol($url){
|
776 |
$data = preg_replace_callback('/.i-amphtml-(.*?){(.*?)}/s',function($matches){ if(!empty($matched)){ return ''; } }, $data);
|
777 |
return $data;
|
778 |
}
|
779 |
+
}
|
780 |
+
|
781 |
+
function checkAMPforPageBuilderStatus($postId){
|
782 |
+
global $post;
|
783 |
+
$postId = (is_object($post)? $post->ID: '');
|
784 |
+
|
785 |
+
if( ampforwp_is_front_page() ){
|
786 |
+
$postId = ampforwp_get_frontpage_id();
|
787 |
+
}
|
788 |
+
if ( empty( $postId ) ) {
|
789 |
+
$response = false;
|
790 |
+
}else{
|
791 |
+
|
792 |
+
$ampforwp_pagebuilder_enable = get_post_meta($postId,'ampforwp_page_builder_enable', true);
|
793 |
+
|
794 |
+
if( $ampforwp_pagebuilder_enable=='yes' && true == ampforwp_get_setting('ampforwp-pagebuilder')){
|
795 |
+
$response = true;
|
796 |
+
}else{
|
797 |
+
$response = false;
|
798 |
+
}
|
799 |
+
$response = apply_filters( 'ampforwp_pagebuilder_status_modify', $response, $postId );
|
800 |
+
}
|
801 |
+
return $response;
|
802 |
}
|
includes/features/structure-data/structured-data-functions.php
CHANGED
@@ -76,7 +76,7 @@
|
|
76 |
}
|
77 |
$structured_data_image = $structured_data_image_url;
|
78 |
$structured_data_height = intval(ampforwp_get_setting('amp-structured-data-placeholder-image-height'));
|
79 |
-
$structured_data_width = intval(
|
80 |
|
81 |
$metadata['image'] = array(
|
82 |
'@type' => 'ImageObject',
|
@@ -396,26 +396,38 @@ add_action('amp_post_template_footer','ampforwp_sd_sitenavigation');
|
|
396 |
function ampforwp_sd_sitenavigation(){
|
397 |
if ( ! class_exists('saswp_fields_generator') ) {
|
398 |
$input = array();
|
399 |
-
$navObj = array();
|
400 |
-
|
|
|
|
|
|
|
401 |
if(!empty($menuLocations) ){
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
|
|
414 |
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
if($navObj){
|
420 |
$input['@context'] = 'https://schema.org';
|
421 |
$input['@graph'] = $navObj; ?>
|
76 |
}
|
77 |
$structured_data_image = $structured_data_image_url;
|
78 |
$structured_data_height = intval(ampforwp_get_setting('amp-structured-data-placeholder-image-height'));
|
79 |
+
$structured_data_width = intval(ampforwp_get_setting('amp-structured-data-placeholder-image-width'));
|
80 |
|
81 |
$metadata['image'] = array(
|
82 |
'@type' => 'ImageObject',
|
396 |
function ampforwp_sd_sitenavigation(){
|
397 |
if ( ! class_exists('saswp_fields_generator') ) {
|
398 |
$input = array();
|
399 |
+
$navObj = array();
|
400 |
+
if ( true == get_transient('ampforwp_header_sd_menu') && true == get_transient('ampforwp_footer_sd_menu') && false != get_transient('ampforwp_sd_menu') ) {
|
401 |
+
$navObj[] = get_transient('ampforwp_sd_menu');
|
402 |
+
}
|
403 |
+
$menuLocations = get_nav_menu_locations();
|
404 |
if(!empty($menuLocations) ){
|
405 |
+
if ( empty($navObj) ) {
|
406 |
+
foreach($menuLocations as $type => $id){
|
407 |
+
if( $type == 'amp-menu' || $type == 'amp-footer-menu' ){
|
408 |
+
$menuItems = wp_get_nav_menu_items($id);
|
409 |
+
if($menuItems){
|
410 |
+
foreach($menuItems as $items){
|
411 |
+
$navObj[] = array(
|
412 |
+
"@context" => "https://schema.org",
|
413 |
+
"@type" => "SiteNavigationElement",
|
414 |
+
"@id" => trailingslashit(get_home_url()).$type,
|
415 |
+
"name" => $items->title,
|
416 |
+
"url" => $items->url
|
417 |
+
);
|
418 |
|
419 |
+
}
|
420 |
+
}
|
421 |
+
}
|
422 |
+
if ( 'amp-menu' == $type ) {
|
423 |
+
set_transient('ampforwp_header_sd_menu', true , 24*HOUR_IN_SECONDS );
|
424 |
+
}
|
425 |
+
if ( 'amp-footer-menu' == $type ) {
|
426 |
+
set_transient('ampforwp_footer_sd_menu', true , 24*HOUR_IN_SECONDS );
|
427 |
+
}
|
428 |
+
set_transient('ampforwp_sd_menu', $navObj , 24*HOUR_IN_SECONDS );
|
429 |
+
}
|
430 |
+
}
|
431 |
if($navObj){
|
432 |
$input['@context'] = 'https://schema.org';
|
433 |
$input['@graph'] = $navObj; ?>
|
includes/options/admin-config.php
CHANGED
@@ -51,6 +51,21 @@ if(!is_plugin_active( 'amp-pagebuilder-compatibility/amp-pagebuilder-compatibili
|
|
51 |
'desc' => sprintf('<div style="background: #FFF9C4;padding: 12px;line-height: 1.6;margin: -45px -14px -18px -17px;"><b>%s</b> %s <a href="https://ampforwp.com/page-builder-compatibility-for-amp/" target="_blank">%s</a> extension.<br /> <div style="margin-top:4px;">(<a href="https://ampforwp.com/page-builder-compatibility-for-amp/" target="_blank">%s</a>)</div></div>',esc_html__( 'ONE LAST STEP REQUIRED:','accelerated-mobile-pages'),esc_html__( 'This feature requires', 'accelerated-mobile-pages' ),esc_html__( 'Page Builder For AMP', 'accelerated-mobile-pages'),esc_html__( 'Click here for more info', 'accelerated-mobile-pages' )),
|
52 |
);
|
53 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
$pb_for_amp[] = array(
|
55 |
'id' => 'ampforwp-wpbakery-pb-for-amp-accor',
|
56 |
'type' => 'section',
|
@@ -2117,16 +2132,6 @@ Redux::setSection( $opt_name, array(
|
|
2117 |
'required'=>array('amp-on-off-for-all-pages','=','1'),
|
2118 |
),
|
2119 |
array(
|
2120 |
-
'id' =>'hide-amp-categories',
|
2121 |
-
'type' => 'checkbox_hierarchy',
|
2122 |
-
'title' => esc_html__('Select Categories to Hide AMP'),
|
2123 |
-
'tooltip-subtitle' => esc_html__( 'Hide AMP from all the posts of a selected category.', 'accelerated-mobile-pages' ),
|
2124 |
-
'default' => 0,
|
2125 |
-
'data' => 'category_list_hierarchy',
|
2126 |
-
|
2127 |
-
'class' => 'hide'
|
2128 |
-
),
|
2129 |
-
array(
|
2130 |
'id' =>'hide-amp-categories2',
|
2131 |
'type' => 'select',
|
2132 |
'title' => __('Select Categories to Hide AMP'),
|
@@ -2136,15 +2141,6 @@ Redux::setSection( $opt_name, array(
|
|
2136 |
'data-action' => 'ampforwp_categories',
|
2137 |
'data' => 'categories',
|
2138 |
),
|
2139 |
-
array(
|
2140 |
-
'id' =>'hide-amp-tags-bulk-option',
|
2141 |
-
'type' => 'checkbox',
|
2142 |
-
'title' => esc_html__('Select Tags to Hide AMP'),
|
2143 |
-
'tooltip-subtitle' => esc_html__( 'Hide AMP from all the posts of a selected tags.', 'accelerated-mobile-pages' ),
|
2144 |
-
'default' => 0,
|
2145 |
-
'data' => 'tags',
|
2146 |
-
'class' => 'hide'
|
2147 |
-
),
|
2148 |
array(
|
2149 |
'id' =>'hide-amp-tags-bulk-option2',
|
2150 |
'type' => 'select',
|
@@ -4001,7 +3997,7 @@ Redux::setSection( $opt_name, array(
|
|
4001 |
)
|
4002 |
)
|
4003 |
);
|
4004 |
-
|
4005 |
$ampforwp_home_loop = array();
|
4006 |
$ampforwp_home_loop = get_option('ampforwp_custom_post_types');
|
4007 |
$ampforwp_home_loop['post'] = 'Posts';
|
@@ -4069,7 +4065,7 @@ Redux::setSection( $opt_name, array(
|
|
4069 |
array('amp-design-3-featured-content', '=' , '2'),
|
4070 |
),
|
4071 |
'ajax' => true,
|
4072 |
-
'data-action' => '
|
4073 |
'data' => 'tags',
|
4074 |
),
|
4075 |
array(
|
51 |
'desc' => sprintf('<div style="background: #FFF9C4;padding: 12px;line-height: 1.6;margin: -45px -14px -18px -17px;"><b>%s</b> %s <a href="https://ampforwp.com/page-builder-compatibility-for-amp/" target="_blank">%s</a> extension.<br /> <div style="margin-top:4px;">(<a href="https://ampforwp.com/page-builder-compatibility-for-amp/" target="_blank">%s</a>)</div></div>',esc_html__( 'ONE LAST STEP REQUIRED:','accelerated-mobile-pages'),esc_html__( 'This feature requires', 'accelerated-mobile-pages' ),esc_html__( 'Page Builder For AMP', 'accelerated-mobile-pages'),esc_html__( 'Click here for more info', 'accelerated-mobile-pages' )),
|
52 |
);
|
53 |
}
|
54 |
+
$pb_for_amp[] = array(
|
55 |
+
'id' => 'ampforwp-pagebuilder-accor',
|
56 |
+
'type' => 'section',
|
57 |
+
'title' => esc_html__('AMPforWP PageBuilder', 'accelerated-mobile-pages'),
|
58 |
+
'indent' => true,
|
59 |
+
'layout_type' => 'accordion',
|
60 |
+
'accordion-open'=> 1,
|
61 |
+
);
|
62 |
+
$pb_for_amp[] = array(
|
63 |
+
'id' => 'ampforwp-pagebuilder',
|
64 |
+
'type' => 'switch',
|
65 |
+
'title' => esc_html__('AMPforWP PageBuilder', 'accelerated-mobile-pages'),
|
66 |
+
'tooltip-subtitle' => esc_html__('Enable or Disable the AMP PageBuilder', 'accelerated-mobile-pages'),
|
67 |
+
'default' => true
|
68 |
+
);
|
69 |
$pb_for_amp[] = array(
|
70 |
'id' => 'ampforwp-wpbakery-pb-for-amp-accor',
|
71 |
'type' => 'section',
|
2132 |
'required'=>array('amp-on-off-for-all-pages','=','1'),
|
2133 |
),
|
2134 |
array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2135 |
'id' =>'hide-amp-categories2',
|
2136 |
'type' => 'select',
|
2137 |
'title' => __('Select Categories to Hide AMP'),
|
2141 |
'data-action' => 'ampforwp_categories',
|
2142 |
'data' => 'categories',
|
2143 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2144 |
array(
|
2145 |
'id' =>'hide-amp-tags-bulk-option2',
|
2146 |
'type' => 'select',
|
3997 |
)
|
3998 |
)
|
3999 |
);
|
4000 |
+
|
4001 |
$ampforwp_home_loop = array();
|
4002 |
$ampforwp_home_loop = get_option('ampforwp_custom_post_types');
|
4003 |
$ampforwp_home_loop['post'] = 'Posts';
|
4065 |
array('amp-design-3-featured-content', '=' , '2'),
|
4066 |
),
|
4067 |
'ajax' => true,
|
4068 |
+
'data-action' => 'ampforwp_tags',
|
4069 |
'data' => 'tags',
|
4070 |
),
|
4071 |
array(
|
includes/options/redux-core/framework.php
CHANGED
@@ -911,6 +911,7 @@
|
|
911 |
$args = wp_parse_args( $args, array() );
|
912 |
|
913 |
if ( $type == "categories" || $type == "category" ) {
|
|
|
914 |
$cats = get_categories( $args );
|
915 |
if ( ! empty ( $cats ) ) {
|
916 |
foreach ( $cats as $cat ) {
|
@@ -987,8 +988,8 @@
|
|
987 |
$data[ $name ] = ucfirst( $name );
|
988 |
}
|
989 |
}
|
990 |
-
} else if ( $type == "tags" || $type == "tag" ) {
|
991 |
-
$args['number'] = 500;
|
992 |
$tags = get_tags( $args );
|
993 |
if ( ! empty ( $tags ) ) {
|
994 |
foreach ( $tags as $tag ) {
|
911 |
$args = wp_parse_args( $args, array() );
|
912 |
|
913 |
if ( $type == "categories" || $type == "category" ) {
|
914 |
+
$args['number'] = apply_filters('ampforwp_number_of_categories', 500);
|
915 |
$cats = get_categories( $args );
|
916 |
if ( ! empty ( $cats ) ) {
|
917 |
foreach ( $cats as $cat ) {
|
988 |
$data[ $name ] = ucfirst( $name );
|
989 |
}
|
990 |
}
|
991 |
+
} else if ( $type == "tags" || $type == "tag" ) {
|
992 |
+
$args['number'] = apply_filters('ampforwp_number_of_tags', 500);
|
993 |
$tags = get_tags( $args );
|
994 |
if ( ! empty ( $tags ) ) {
|
995 |
foreach ( $tags as $tag ) {
|
includes/options/redux-core/inc/fields/select/field_select.php
CHANGED
@@ -114,7 +114,7 @@ if ( ! class_exists( 'ReduxFramework_select' ) ) {
|
|
114 |
}
|
115 |
|
116 |
$sortable = ( isset( $this->field['sortable'] ) && $this->field['sortable'] ) ? ' select2-sortable"' : "";
|
117 |
-
echo '<select ' . $multi . ' id="' . $this->field['id'] . '-select" data-placeholder="' . $placeholder . '" name="' . $this->field['name'] . $this->field['name_suffix'] . $nameBrackets . '" class="redux-select-item ' . 'redux-select-item'.$ajax. $this->field['class'] . $sortable . '"' . $width . ' rows="6" '.$action.'>';
|
118 |
$redux_options = get_option('redux_builder_amp');
|
119 |
$options = $new_options = array();
|
120 |
if ( isset($this->field['data']) && 'categories' == $this->field['data'] ) {
|
114 |
}
|
115 |
|
116 |
$sortable = ( isset( $this->field['sortable'] ) && $this->field['sortable'] ) ? ' select2-sortable"' : "";
|
117 |
+
echo '<select ' . $multi . ' id="' . $this->field['id'] . '-select" data-placeholder="' . $placeholder . '" name="' . $this->field['name'] . $this->field['name_suffix'] . $nameBrackets . '" class="redux-select-item ' . 'redux-select-item'.$ajax. ' ' . $this->field['class'] . $sortable . '"' . $width . ' rows="6" '.$action.'>';
|
118 |
$redux_options = get_option('redux_builder_amp');
|
119 |
$options = $new_options = array();
|
120 |
if ( isset($this->field['data']) && 'categories' == $this->field['data'] ) {
|
includes/redirect.php
CHANGED
@@ -3,19 +3,22 @@
|
|
3 |
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
exit;
|
5 |
}
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
$
|
|
|
10 |
$hide_cats_amp = is_category_amp_disabled();
|
|
|
11 |
if ( ampforwp_is_amp_endpoint() ) {
|
12 |
-
|
13 |
-
|
|
|
|
|
14 |
$url = $wp->request;
|
15 |
if( ampforwp_is_home() && get_query_var('amp') ) {
|
16 |
$url = 'amp';
|
17 |
}
|
18 |
-
|
19 |
$redirection_location = add_query_arg( '', '', home_url( $url ) );
|
20 |
|
21 |
$redirection_location = trailingslashit($redirection_location );
|
@@ -25,13 +28,31 @@ function ampforwp_check_amp_page_status() {
|
|
25 |
exit;
|
26 |
}
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
// AMP Takeover
|
29 |
-
if (
|
30 |
$redirection_location = '';
|
31 |
$current_location = '';
|
32 |
$home_url = '';
|
33 |
$blog_page_id = '';
|
34 |
-
|
35 |
$current_location = home_url( $wp->request);
|
36 |
$home_url = get_bloginfo('url');
|
37 |
|
@@ -39,7 +60,7 @@ function ampforwp_check_amp_page_status() {
|
|
39 |
* If certain conditions does not match then return early and exit from redirection
|
40 |
*/
|
41 |
|
42 |
-
// return if the current page is Feed page, as we don't need anything on feedpaged
|
43 |
if ( is_feed() ) {
|
44 |
return;
|
45 |
}
|
@@ -63,10 +84,12 @@ function ampforwp_check_amp_page_status() {
|
|
63 |
if ( is_home() && ampforwp_is_front_page() && ! ampforwp_is_home() ) {
|
64 |
return;
|
65 |
}
|
|
|
66 |
//blogpage
|
67 |
if ( is_home() && $redux_builder_amp['amp-on-off-for-all-pages']==false ) {
|
68 |
return;
|
69 |
}
|
|
|
70 |
// Enabling AMP Takeover only when selected in Custom Post Type
|
71 |
$supported_types_for_takeover = array();
|
72 |
$supported_types_for_takeover = ampforwp_get_all_post_types();
|
@@ -77,7 +100,13 @@ function ampforwp_check_amp_page_status() {
|
|
77 |
}
|
78 |
}
|
79 |
// Single and Pages
|
80 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
return;
|
82 |
}
|
83 |
|
@@ -103,75 +132,42 @@ function ampforwp_check_amp_page_status() {
|
|
103 |
if ( empty( $redirection_location ) ) {
|
104 |
$redirection_location = $home_url;
|
105 |
}
|
106 |
-
|
107 |
-
if (function_exists('tml_register_default_actions')){
|
108 |
-
$tml_pages = theme_my_login()->get_actions();
|
109 |
-
$current_page = home_url( $wp->request);
|
110 |
-
$current_page = explode('/', $current_page);
|
111 |
-
if ( isset($tml_pages) && $tml_pages ) {
|
112 |
-
foreach ($tml_pages as $page) {
|
113 |
-
if ( in_array($page->get_slug(), $current_page)) {
|
114 |
-
return false;
|
115 |
-
}
|
116 |
-
}
|
117 |
-
}
|
118 |
-
}
|
119 |
wp_safe_redirect( $redirection_location );
|
120 |
-
exit;
|
121 |
-
|
122 |
}
|
123 |
-
}
|
124 |
-
add_action( 'template_redirect', 'ampforwp_check_amp_page_status', 10 );
|
125 |
-
|
126 |
|
127 |
-
//
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
$post_type = get_post_type();
|
138 |
-
|
139 |
-
if(is_home() || is_front_page()){
|
140 |
-
if(isset($redux_builder_amp['ampforwp-homepage-on-off-support'])
|
141 |
-
&& $redux_builder_amp['ampforwp-homepage-on-off-support'] == 1
|
142 |
-
&& isset($redux_builder_amp['amp-on-off-for-all-posts'])
|
143 |
-
&& $redux_builder_amp['amp-on-off-for-all-posts'] == 0
|
144 |
-
&& isset($redux_builder_amp['amp-on-off-for-all-pages'])
|
145 |
-
&& $redux_builder_amp['amp-on-off-for-all-pages'] == 0 ){
|
146 |
-
|
147 |
-
$supported_types['post'] = 'post';
|
148 |
-
}
|
149 |
-
}
|
150 |
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
if ( isset($redux_builder_amp['amp-mobile-redirection']) && $redux_builder_amp['amp-mobile-redirection'] ) {
|
156 |
$mobile_detect = $isTablet = '';
|
157 |
-
require_once AMPFORWP_PLUGIN_DIR.'/includes/vendor/Mobile_Detect.php';
|
158 |
// instantiate the Mobile detect class
|
159 |
-
$mobile_detect
|
160 |
-
$isMobile
|
161 |
-
$isTablet
|
162 |
$isTabletUserAction = ampforwp_get_setting('amp-tablet-redirection');
|
163 |
|
164 |
$redirectToAMP = false;
|
165 |
-
if( $isMobile && $isTabletUserAction && $isTablet ){
|
166 |
$redirectToAMP = true;
|
167 |
-
}else if($isMobile && !$isTablet){
|
168 |
$redirectToAMP = true;
|
169 |
}
|
|
|
170 |
// No mobile redirection on oembeds #2003
|
171 |
if ( function_exists('is_embed') && is_embed() ){
|
172 |
return;
|
173 |
}
|
174 |
-
|
175 |
// Return if Dev mode is enabled
|
176 |
if ( isset($redux_builder_amp['ampforwp-development-mode']) && $redux_builder_amp['ampforwp-development-mode'] ) {
|
177 |
return;
|
@@ -198,40 +194,8 @@ function ampforwp_page_template_redirect() {
|
|
198 |
}
|
199 |
|
200 |
// Return if some categories are selected as Hide #999
|
201 |
-
if (
|
202 |
-
|
203 |
-
$all_tags = get_the_tags();
|
204 |
-
$tagsOnPost = array();
|
205 |
-
foreach ($all_tags as $tagskey => $tagsvalue) {
|
206 |
-
$tagsOnPost[] = $tagsvalue->term_id;
|
207 |
-
}
|
208 |
-
$get_tags_checkbox = array_keys(array_filter($redux_builder_amp['hide-amp-tags-bulk-option']));
|
209 |
-
|
210 |
-
if( count(array_intersect($get_tags_checkbox,$tagsOnPost))>0 ){
|
211 |
-
return;
|
212 |
-
}
|
213 |
-
}//tags check area closed
|
214 |
-
|
215 |
-
$selected_cats = array();
|
216 |
-
$categories = get_the_category();
|
217 |
-
$get_categories_from_checkbox = $redux_builder_amp['hide-amp-categories'];
|
218 |
-
// Check if $get_categories_from_checkbox has some cats then only show
|
219 |
-
if ( $get_categories_from_checkbox ) {
|
220 |
-
$get_selected_cats = array_filter($get_categories_from_checkbox);
|
221 |
-
foreach ( $get_selected_cats as $key => $value ) {
|
222 |
-
$selected_cats[] = $key;
|
223 |
-
}
|
224 |
-
if ( $categories ) {
|
225 |
-
foreach ($categories as $key => $cats) {
|
226 |
-
$current_cats_ids[] =$cats->cat_ID;
|
227 |
-
}
|
228 |
-
}
|
229 |
-
if ( $selected_cats && $current_cats_ids ) {
|
230 |
-
if( count(array_intersect($selected_cats,$current_cats_ids))>0 ){
|
231 |
-
return;
|
232 |
-
}
|
233 |
-
}
|
234 |
-
}
|
235 |
}
|
236 |
|
237 |
// If we are in AMP mode then retrun and dont start redirection
|
@@ -266,9 +230,10 @@ function ampforwp_page_template_redirect() {
|
|
266 |
session_destroy();
|
267 |
}
|
268 |
}
|
|
|
269 |
if ( function_exists('weglot_plugin_loaded') ) {
|
270 |
$url_to_redirect = ampforwp_get_weglot_url();
|
271 |
-
$url_to_redirect = ampforwp_url_controller($url_to_redirect);
|
272 |
}
|
273 |
// Check if we are on Mobile phones then start redirection process
|
274 |
if ( $redirectToAMP ) {
|
@@ -277,51 +242,22 @@ function ampforwp_page_template_redirect() {
|
|
277 |
$_SESSION['ampforwp_amp_mode'] = 'mobile-on';
|
278 |
|
279 |
if ( $url_to_redirect ) {
|
280 |
-
wp_redirect(
|
281 |
exit();
|
282 |
-
}
|
283 |
-
|
284 |
// if nothing matches then return back
|
285 |
return;
|
286 |
}
|
287 |
}
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
function ampforwp_page_template_redirect_archive() {
|
295 |
-
|
296 |
-
if ( is_404() ) {
|
297 |
-
return;
|
298 |
-
if ( ampforwp_is_amp_endpoint() ) {
|
299 |
-
global $wp;
|
300 |
-
$ampforwp_404_url = add_query_arg( '', '', home_url( $wp->request ) );
|
301 |
-
$ampforwp_404_url = trailingslashit($ampforwp_404_url );
|
302 |
-
$ampforwp_404_url = dirname($ampforwp_404_url);
|
303 |
-
wp_redirect( esc_url( $ampforwp_404_url ) , 301 );
|
304 |
-
exit();
|
305 |
}
|
306 |
-
|
307 |
-
|
308 |
-
// #1947 when nonamp=1 it should redirect to original link so that google
|
309 |
-
function ampforwp_custom_query_var($vars) {
|
310 |
-
$vars[] = 'nonamp';
|
311 |
-
return $vars;
|
312 |
-
}
|
313 |
-
add_filter( 'query_vars', 'ampforwp_custom_query_var' );
|
314 |
-
add_action( 'template_redirect', 'ampforwp_redirect_to_orginal_url' );
|
315 |
-
function ampforwp_redirect_to_orginal_url(){
|
316 |
-
global $wp;
|
317 |
-
$go_to_url = "";
|
318 |
-
$url = "";
|
319 |
-
$url = ampforwp_amphtml_generator();
|
320 |
-
if ( empty($url) ) {
|
321 |
-
$url = home_url( $wp->request );
|
322 |
-
}
|
323 |
-
$nonamp_checker = get_query_var( 'nonamp');
|
324 |
-
if($url){
|
325 |
if( $nonamp_checker == 1 ){
|
326 |
$go_to_url = remove_query_arg('nonamp', $url);
|
327 |
$go_to_url = explode('/', $go_to_url);
|
@@ -342,28 +278,30 @@ function ampforwp_redirect_to_orginal_url(){
|
|
342 |
return;
|
343 |
}
|
344 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
return;
|
|
|
346 |
}
|
347 |
-
// #1947 ends here
|
348 |
|
349 |
-
//
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
$amp = AMPFORWP_AMP_QUERY_VAR;
|
357 |
-
$endpoint = '?'.$amp;
|
358 |
-
$checker = explode('/', $current_url);
|
359 |
-
$amp_check = in_array($amp, $checker);
|
360 |
-
if ( true == $amp_check && $amp == end($checker) ) {
|
361 |
-
$pos = strrpos( $current_url , '/'.$amp);
|
362 |
-
$search_length = strlen('/'.$amp);
|
363 |
-
$new_url = substr_replace( $current_url , $endpoint , $pos , $search_length );
|
364 |
-
wp_safe_redirect( $new_url );
|
365 |
-
exit;
|
366 |
-
}
|
367 |
-
}
|
368 |
-
}
|
369 |
-
}
|
3 |
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
exit;
|
5 |
}
|
6 |
+
|
7 |
+
add_action( 'template_redirect', 'ampforwp_redirection', 10 );
|
8 |
+
function ampforwp_redirection() {
|
9 |
+
global $redux_builder_amp, $wp, $post;
|
10 |
+
$hide_cats_amp = $url = $archive_check = $go_to_url = '';
|
11 |
$hide_cats_amp = is_category_amp_disabled();
|
12 |
+
// Redirection for Homepage and Archive Pages when Turned Off from options panel
|
13 |
if ( ampforwp_is_amp_endpoint() ) {
|
14 |
+
if( is_archive() && 0 == ampforwp_get_setting('ampforwp-archive-support') ){
|
15 |
+
$archive_check = true;
|
16 |
+
}
|
17 |
+
if ( ( true == $archive_check ) || true == $hide_cats_amp || ((ampforwp_is_home() || ampforwp_is_front_page()) && 0 == ampforwp_get_setting('ampforwp-homepage-on-off-support')) ) {
|
18 |
$url = $wp->request;
|
19 |
if( ampforwp_is_home() && get_query_var('amp') ) {
|
20 |
$url = 'amp';
|
21 |
}
|
|
|
22 |
$redirection_location = add_query_arg( '', '', home_url( $url ) );
|
23 |
|
24 |
$redirection_location = trailingslashit($redirection_location );
|
28 |
exit;
|
29 |
}
|
30 |
}
|
31 |
+
|
32 |
+
//Auto redirect /amp to ?amp when 'Change End Point to ?amp' option is enabled #2480
|
33 |
+
if ( ampforwp_is_amp_endpoint() && true == ampforwp_get_setting('amp-core-end-point') ){
|
34 |
+
$current_url = $endpoint = $new_url = '';
|
35 |
+
$current_url = home_url($wp->request);
|
36 |
+
$amp = AMPFORWP_AMP_QUERY_VAR;
|
37 |
+
$endpoint = '?'.$amp;
|
38 |
+
$checker = explode('/', $current_url);
|
39 |
+
$amp_check = in_array($amp, $checker);
|
40 |
+
if ( true == $amp_check && $amp == end($checker) ) {
|
41 |
+
$pos = strrpos( $current_url , '/'.$amp);
|
42 |
+
$search_length = strlen('/'.$amp);
|
43 |
+
$new_url = substr_replace( $current_url , $endpoint , $pos , $search_length );
|
44 |
+
wp_safe_redirect( $new_url );
|
45 |
+
exit;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
// AMP Takeover
|
50 |
+
if ( ampforwp_get_setting('ampforwp-amp-takeover') && !ampforwp_is_non_amp() ) {
|
51 |
$redirection_location = '';
|
52 |
$current_location = '';
|
53 |
$home_url = '';
|
54 |
$blog_page_id = '';
|
55 |
+
$amp_on_off = '';
|
56 |
$current_location = home_url( $wp->request);
|
57 |
$home_url = get_bloginfo('url');
|
58 |
|
60 |
* If certain conditions does not match then return early and exit from redirection
|
61 |
*/
|
62 |
|
63 |
+
// return if the current page is Feed page, as we don't need anything on feedpaged
|
64 |
if ( is_feed() ) {
|
65 |
return;
|
66 |
}
|
84 |
if ( is_home() && ampforwp_is_front_page() && ! ampforwp_is_home() ) {
|
85 |
return;
|
86 |
}
|
87 |
+
|
88 |
//blogpage
|
89 |
if ( is_home() && $redux_builder_amp['amp-on-off-for-all-pages']==false ) {
|
90 |
return;
|
91 |
}
|
92 |
+
|
93 |
// Enabling AMP Takeover only when selected in Custom Post Type
|
94 |
$supported_types_for_takeover = array();
|
95 |
$supported_types_for_takeover = ampforwp_get_all_post_types();
|
100 |
}
|
101 |
}
|
102 |
// Single and Pages
|
103 |
+
if ( is_singular() ) {
|
104 |
+
$amp_metas = json_decode(get_post_meta( get_the_ID(),'ampforwp-post-metas',true), true );
|
105 |
+
if ( 'hide-amp' == $amp_metas['ampforwp-amp-on-off'] ) {
|
106 |
+
$amp_on_off = true;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
if ( ( is_single() && !$redux_builder_amp['amp-on-off-for-all-posts'] ) || ( is_page() && !$redux_builder_amp['amp-on-off-for-all-pages'] ) || ($amp_on_off) ) {
|
110 |
return;
|
111 |
}
|
112 |
|
132 |
if ( empty( $redirection_location ) ) {
|
133 |
$redirection_location = $home_url;
|
134 |
}
|
135 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
wp_safe_redirect( $redirection_location );
|
137 |
+
exit;
|
|
|
138 |
}
|
|
|
|
|
|
|
139 |
|
140 |
+
// Mobile redirection
|
141 |
+
if ( ampforwp_get_setting('amp-mobile-redirection') ) {
|
142 |
+
require_once AMPFORWP_PLUGIN_DIR.'/includes/vendor/Mobile_Detect.php';
|
143 |
+
$post_type = '';
|
144 |
+
$supported_types = '';
|
145 |
+
$supported_amp_post_types = array();
|
146 |
+
$url_to_redirect = '';
|
147 |
+
$supported_types = ampforwp_get_all_post_types();
|
148 |
+
$supported_types = apply_filters('get_amp_supported_post_types',$supported_types);
|
149 |
+
$post_type = get_post_type();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
|
151 |
+
$supported_amp_post_types = in_array( $post_type , $supported_types );
|
152 |
+
$url_to_redirect = ampforwp_amphtml_generator();
|
|
|
|
|
|
|
153 |
$mobile_detect = $isTablet = '';
|
|
|
154 |
// instantiate the Mobile detect class
|
155 |
+
$mobile_detect = new AMPforWP_Mobile_Detect;
|
156 |
+
$isMobile = $mobile_detect->isMobile();
|
157 |
+
$isTablet = $mobile_detect->isTablet();
|
158 |
$isTabletUserAction = ampforwp_get_setting('amp-tablet-redirection');
|
159 |
|
160 |
$redirectToAMP = false;
|
161 |
+
if( $isMobile && $isTabletUserAction && $isTablet ){ //Only For tablet
|
162 |
$redirectToAMP = true;
|
163 |
+
}else if($isMobile && !$isTablet){ // Only for mobile
|
164 |
$redirectToAMP = true;
|
165 |
}
|
166 |
+
|
167 |
// No mobile redirection on oembeds #2003
|
168 |
if ( function_exists('is_embed') && is_embed() ){
|
169 |
return;
|
170 |
}
|
|
|
171 |
// Return if Dev mode is enabled
|
172 |
if ( isset($redux_builder_amp['ampforwp-development-mode']) && $redux_builder_amp['ampforwp-development-mode'] ) {
|
173 |
return;
|
194 |
}
|
195 |
|
196 |
// Return if some categories are selected as Hide #999
|
197 |
+
if ( is_category_amp_disabled() ) {
|
198 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
}
|
200 |
|
201 |
// If we are in AMP mode then retrun and dont start redirection
|
230 |
session_destroy();
|
231 |
}
|
232 |
}
|
233 |
+
|
234 |
if ( function_exists('weglot_plugin_loaded') ) {
|
235 |
$url_to_redirect = ampforwp_get_weglot_url();
|
236 |
+
$url_to_redirect = ampforwp_url_controller($url_to_redirect);
|
237 |
}
|
238 |
// Check if we are on Mobile phones then start redirection process
|
239 |
if ( $redirectToAMP ) {
|
242 |
$_SESSION['ampforwp_amp_mode'] = 'mobile-on';
|
243 |
|
244 |
if ( $url_to_redirect ) {
|
245 |
+
wp_redirect( $url_to_redirect , 301 );
|
246 |
exit();
|
247 |
+
}
|
|
|
248 |
// if nothing matches then return back
|
249 |
return;
|
250 |
}
|
251 |
}
|
252 |
+
// #1947 when nonamp=1 it should redirect to original link
|
253 |
+
$go_to_url = "";
|
254 |
+
$url = "";
|
255 |
+
$url = ampforwp_amphtml_generator();
|
256 |
+
if ( empty($url) ) {
|
257 |
+
$url = home_url( $wp->request );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
}
|
259 |
+
$nonamp_checker = get_query_var( 'nonamp');
|
260 |
+
if($url){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
if( $nonamp_checker == 1 ){
|
262 |
$go_to_url = remove_query_arg('nonamp', $url);
|
263 |
$go_to_url = explode('/', $go_to_url);
|
278 |
return;
|
279 |
}
|
280 |
}
|
281 |
+
if ( ampforwp_is_amp_endpoint() && true == ampforwp_get_setting('amp-core-end-point') ){
|
282 |
+
$current_url = $endpoint = $new_url = '';
|
283 |
+
$current_url = home_url($wp->request);
|
284 |
+
$amp = AMPFORWP_AMP_QUERY_VAR;
|
285 |
+
$endpoint = '?'.$amp;
|
286 |
+
$checker = explode('/', $current_url);
|
287 |
+
$amp_check = in_array($amp, $checker);
|
288 |
+
if ( true == $amp_check && $amp == end($checker) ) {
|
289 |
+
$pos = strrpos( $current_url , '/'.$amp);
|
290 |
+
$search_length = strlen('/'.$amp);
|
291 |
+
$new_url = substr_replace( $current_url , $endpoint , $pos , $search_length );
|
292 |
+
wp_safe_redirect( $new_url );
|
293 |
+
exit;
|
294 |
+
}
|
295 |
+
}
|
296 |
+
session_destroy();
|
297 |
return;
|
298 |
+
}
|
299 |
}
|
|
|
300 |
|
301 |
+
// #1947 when nonamp=1 it should redirect to original link so that google
|
302 |
+
add_filter( 'query_vars', 'ampforwp_custom_query_var' );
|
303 |
+
function ampforwp_custom_query_var($vars) {
|
304 |
+
$vars[] = 'nonamp';
|
305 |
+
return $vars;
|
306 |
+
}
|
307 |
+
// #1947 ends here
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/vendor/amp/amp.php
CHANGED
@@ -86,6 +86,10 @@ if ( ! function_exists('AMPforWP\\AMPVendor\\amp_render') ) {
|
|
86 |
amp_add_post_template_actions();
|
87 |
$template = $ampforwpTemplate = new AMP_Post_Template( $post_id );
|
88 |
$template->load();
|
|
|
|
|
|
|
|
|
89 |
exit;
|
90 |
}
|
91 |
}
|
86 |
amp_add_post_template_actions();
|
87 |
$template = $ampforwpTemplate = new AMP_Post_Template( $post_id );
|
88 |
$template->load();
|
89 |
+
// Set Header: last modified information
|
90 |
+
if( is_singular() && $post_id ) {
|
91 |
+
header("Last-Modified: " . get_the_modified_time("D, d M Y H:i:s", $post_id) );
|
92 |
+
}
|
93 |
exit;
|
94 |
}
|
95 |
}
|
pagebuilder/functions.php
CHANGED
@@ -108,13 +108,10 @@ function amppbbase_admin_scripts( $hook_suffix ){
|
|
108 |
);
|
109 |
wp_localize_script( 'amppb-admin', 'amppb_panel_options',$components_options);
|
110 |
wp_enqueue_script('amppb-admin');
|
111 |
-
add_action( 'admin_footer', 'js_templates',9999);
|
112 |
-
|
113 |
-
|
114 |
}
|
115 |
}
|
116 |
|
117 |
-
|
118 |
function js_templates() {
|
119 |
global $containerCommonSettings;
|
120 |
global $moduleTemplate;
|
@@ -122,31 +119,7 @@ function js_templates() {
|
|
122 |
global $savedlayoutTemplate;
|
123 |
include plugin_dir_path( __FILE__ ) . '/inc/js-templates.php';
|
124 |
}
|
125 |
-
|
126 |
-
global $post, $redux_builder_amp;
|
127 |
-
$postId = (is_object($post)? $post->ID: '');
|
128 |
-
|
129 |
-
if( ampforwp_is_front_page() ){
|
130 |
-
$postId = ampforwp_get_frontpage_id();
|
131 |
-
}
|
132 |
-
if ( empty( $postId ) ) {
|
133 |
-
$response = false;
|
134 |
-
}else{
|
135 |
-
|
136 |
-
$ampforwp_pagebuilder_enable = get_post_meta($postId,'ampforwp_page_builder_enable', true);
|
137 |
-
|
138 |
-
if( $ampforwp_pagebuilder_enable=='yes'){
|
139 |
-
$response = true;
|
140 |
-
}else{
|
141 |
-
$response = false;
|
142 |
-
}
|
143 |
-
$response = apply_filters( 'ampforwp_pagebuilder_status_modify', $response, $postId );
|
144 |
-
}
|
145 |
-
return $response;
|
146 |
-
}
|
147 |
-
|
148 |
require_once AMP_PAGE_BUILDER.'inc/amppb_save_data.php';
|
149 |
require_once AMP_PAGE_BUILDER.'inc/viewShowFrontData.php';
|
150 |
-
require_once AMP_PAGE_BUILDER.'inc/adminAjaxContents.php';
|
151 |
-
|
152 |
-
|
108 |
);
|
109 |
wp_localize_script( 'amppb-admin', 'amppb_panel_options',$components_options);
|
110 |
wp_enqueue_script('amppb-admin');
|
111 |
+
add_action( 'admin_footer', 'js_templates',9999);
|
|
|
|
|
112 |
}
|
113 |
}
|
114 |
|
|
|
115 |
function js_templates() {
|
116 |
global $containerCommonSettings;
|
117 |
global $moduleTemplate;
|
119 |
global $savedlayoutTemplate;
|
120 |
include plugin_dir_path( __FILE__ ) . '/inc/js-templates.php';
|
121 |
}
|
122 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
require_once AMP_PAGE_BUILDER.'inc/amppb_save_data.php';
|
124 |
require_once AMP_PAGE_BUILDER.'inc/viewShowFrontData.php';
|
125 |
+
require_once AMP_PAGE_BUILDER.'inc/adminAjaxContents.php';
|
|
|
|
pagebuilder/modules/contents-module.php
CHANGED
@@ -44,7 +44,8 @@ if ( is_admin() ) {
|
|
44 |
$post_types['post'] = 'post';
|
45 |
$categories = get_categories( array(
|
46 |
'orderby' => 'name',
|
47 |
-
'order' => 'ASC'
|
|
|
48 |
) );
|
49 |
$categoriesArray = array('recent_option'=>'Recent Posts');
|
50 |
foreach($categories as $category){
|
44 |
$post_types['post'] = 'post';
|
45 |
$categories = get_categories( array(
|
46 |
'orderby' => 'name',
|
47 |
+
'order' => 'ASC',
|
48 |
+
'number' => 500
|
49 |
) );
|
50 |
$categoriesArray = array('recent_option'=>'Recent Posts');
|
51 |
foreach($categories as $category){
|
readme.txt
CHANGED
@@ -194,14 +194,13 @@ You can contact us from [here](https://ampforwp.com/contact/)
|
|
194 |
|
195 |
== Changelog ==
|
196 |
|
197 |
-
= 0.9.97.
|
198 |
-
* Fixed:
|
199 |
-
* Fixed:
|
200 |
-
* Fixed:
|
201 |
-
* Fixed:
|
202 |
-
* Fixed:
|
203 |
-
* Fixed:
|
204 |
-
* Fixed:
|
205 |
-
* Fixed: Fatal error Uncaught TypeError Argument 1 passed to DOMNode::replaceChild() #3203
|
206 |
|
207 |
Full changelog available in changelog.txt
|
194 |
|
195 |
== Changelog ==
|
196 |
|
197 |
+
= 0.9.97.54 (23rd May 2019) =
|
198 |
+
* Fixed: HUGE PERFORMANCE Issues #3052
|
199 |
+
* Fixed: Performance Issue with queries #2997
|
200 |
+
* Fixed: Performance Issues with template_redirect hooks #2773 #2920
|
201 |
+
* Fixed: Performance Issues with Design manager #2873
|
202 |
+
* Fixed: Performance Issues with ampforwp_exclude_post option #3118
|
203 |
+
* Fixed: Performance Issues with AMP Pagebuilder modules and settings which were loading By default #2323
|
204 |
+
* Fixed: Performance Issues with Hide AMP Bulk Tools #2549
|
|
|
205 |
|
206 |
Full changelog available in changelog.txt
|
templates/category-widget.php
CHANGED
@@ -37,7 +37,7 @@ class AMPFORWP_Categories_Widget extends WP_Widget {
|
|
37 |
// echo . $args['before_title'] . . $args['after_title']; ?>
|
38 |
|
39 |
<?php
|
40 |
-
$exclude_ids =
|
41 |
|
42 |
$args = array(
|
43 |
'cat' => $ampforwp_category_id,
|
@@ -136,7 +136,8 @@ class AMPFORWP_Categories_Widget extends WP_Widget {
|
|
136 |
|
137 |
$categories = get_categories( array(
|
138 |
'orderby' => 'name',
|
139 |
-
'order' => 'ASC'
|
|
|
140 |
) );
|
141 |
|
142 |
echo '<option selected value="none">Recent Posts </option>';
|
37 |
// echo . $args['before_title'] . . $args['after_title']; ?>
|
38 |
|
39 |
<?php
|
40 |
+
$exclude_ids = ampforwp_exclude_posts();
|
41 |
|
42 |
$args = array(
|
43 |
'cat' => $ampforwp_category_id,
|
136 |
|
137 |
$categories = get_categories( array(
|
138 |
'orderby' => 'name',
|
139 |
+
'order' => 'ASC',
|
140 |
+
'number' => 500
|
141 |
) );
|
142 |
|
143 |
echo '<option selected value="none">Recent Posts </option>';
|
templates/design-manager/design-1/footer.php
CHANGED
@@ -6,17 +6,14 @@ wp_reset_postdata(); ?>
|
|
6 |
<?php if ( has_nav_menu( 'amp-footer-menu' ) ) { ?>
|
7 |
<div class="footer_menu">
|
8 |
<nav>
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
$sanitizer_obj = new AMPFORWP_Content( $menu, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
|
18 |
-
$sanitized_menu = $sanitizer_obj->get_amp_content();
|
19 |
-
echo $sanitized_menu;//amphtml content, no kses ?>
|
20 |
</nav>
|
21 |
</div>
|
22 |
<?php } ?>
|
6 |
<?php if ( has_nav_menu( 'amp-footer-menu' ) ) { ?>
|
7 |
<div class="footer_menu">
|
8 |
<nav>
|
9 |
+
<?php
|
10 |
+
$menu_args = array(
|
11 |
+
'theme_location' => 'amp-footer-menu',
|
12 |
+
'link_before' => '<span>',
|
13 |
+
'link_after' => '</span>',
|
14 |
+
'echo' => false
|
15 |
+
);
|
16 |
+
amp_menu(true, $menu_args, 'footer'); ?>
|
|
|
|
|
|
|
17 |
</nav>
|
18 |
</div>
|
19 |
<?php } ?>
|
templates/design-manager/design-1/header-bar.php
CHANGED
@@ -33,22 +33,16 @@
|
|
33 |
<div role="button" tabindex="0" on='tap:sidebar.close' class="close-nav">X</div>
|
34 |
<nav id ="primary-amp-menu">
|
35 |
<?php
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
) );
|
47 |
-
$menu_html_content = apply_filters('ampforwp_menu_content', $menu_html_content);
|
48 |
-
$sanitizer_obj = new AMPFORWP_Content( $menu_html_content, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
|
49 |
-
$sanitized_menu = $sanitizer_obj->get_amp_content();
|
50 |
-
echo $sanitized_menu; // amphtml content, no kses
|
51 |
-
?>
|
52 |
</nav>
|
53 |
<?php do_action('ampforwp_after_amp_menu'); ?>
|
54 |
</div>
|
33 |
<div role="button" tabindex="0" on='tap:sidebar.close' class="close-nav">X</div>
|
34 |
<nav id ="primary-amp-menu">
|
35 |
<?php
|
36 |
+
$menu_args = array(
|
37 |
+
'theme_location' => 'amp-menu' ,
|
38 |
+
'link_before' => '<span>',
|
39 |
+
'link_after' => '</span>',
|
40 |
+
'menu'=>'ul',
|
41 |
+
'echo' => false,
|
42 |
+
'menu_class' => 'menu amp-menu',
|
43 |
+
'walker' => new Ampforwp_Walker_Nav_Menu()
|
44 |
+
);
|
45 |
+
amp_menu( true, $menu_args, 'header' );?>
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
</nav>
|
47 |
<?php do_action('ampforwp_after_amp_menu'); ?>
|
48 |
</div>
|
templates/design-manager/design-1/index.php
CHANGED
@@ -35,7 +35,7 @@
|
|
35 |
$paged = 1;
|
36 |
}
|
37 |
|
38 |
-
$exclude_ids =
|
39 |
|
40 |
$args = array(
|
41 |
'post_type' => 'post',
|
35 |
$paged = 1;
|
36 |
}
|
37 |
|
38 |
+
$exclude_ids = ampforwp_exclude_posts();
|
39 |
|
40 |
$args = array(
|
41 |
'post_type' => 'post',
|
templates/design-manager/design-1/search.php
CHANGED
@@ -42,7 +42,7 @@
|
|
42 |
$paged = 1;
|
43 |
}
|
44 |
|
45 |
-
$exclude_ids =
|
46 |
|
47 |
$q = new WP_Query( apply_filters('ampforwp_query_args', array(
|
48 |
's' => get_search_query() ,
|
42 |
$paged = 1;
|
43 |
}
|
44 |
|
45 |
+
$exclude_ids = ampforwp_exclude_posts();
|
46 |
|
47 |
$q = new WP_Query( apply_filters('ampforwp_query_args', array(
|
48 |
's' => get_search_query() ,
|
templates/design-manager/design-2/footer.php
CHANGED
@@ -5,17 +5,14 @@
|
|
5 |
<?php if ( has_nav_menu( 'amp-footer-menu' ) ) { ?>
|
6 |
<div class="footer_menu">
|
7 |
<nav>
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
$sanitizer_obj = new AMPFORWP_Content( $menu, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
|
17 |
-
$sanitized_menu = $sanitizer_obj->get_amp_content();
|
18 |
-
echo $sanitized_menu;//amphtml content, no kses ?>
|
19 |
</nav>
|
20 |
</div>
|
21 |
<?php } ?>
|
5 |
<?php if ( has_nav_menu( 'amp-footer-menu' ) ) { ?>
|
6 |
<div class="footer_menu">
|
7 |
<nav>
|
8 |
+
<?php
|
9 |
+
$menu_args = array(
|
10 |
+
'theme_location' => 'amp-footer-menu',
|
11 |
+
'link_before' => '<span>',
|
12 |
+
'link_after' => '</span>',
|
13 |
+
'echo' => false
|
14 |
+
);
|
15 |
+
amp_menu( true, $menu_args, 'footer' ); ?>
|
|
|
|
|
|
|
16 |
</nav>
|
17 |
</div>
|
18 |
<?php } ?>
|
templates/design-manager/design-2/header-bar.php
CHANGED
@@ -23,21 +23,16 @@
|
|
23 |
<div role="button" tabindex="0" on='tap:sidebar.close' class="close-nav">X</div>
|
24 |
<nav id ="primary-amp-menu">
|
25 |
<?php
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
$menu_html_content = apply_filters('ampforwp_menu_content',$menu_html_content);
|
37 |
-
$sanitizer_obj = new AMPFORWP_Content( $menu_html_content, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
|
38 |
-
$sanitized_menu = $sanitizer_obj->get_amp_content();
|
39 |
-
echo $sanitized_menu; //amphtml content, no kses
|
40 |
-
?>
|
41 |
</nav>
|
42 |
<?php do_action('ampforwp_after_amp_menu'); ?>
|
43 |
</div>
|
23 |
<div role="button" tabindex="0" on='tap:sidebar.close' class="close-nav">X</div>
|
24 |
<nav id ="primary-amp-menu">
|
25 |
<?php
|
26 |
+
$menu_args = array(
|
27 |
+
'theme_location' => 'amp-menu' ,
|
28 |
+
'link_before' => '<span>',
|
29 |
+
'link_after' => '</span>',
|
30 |
+
'menu' =>'ul',
|
31 |
+
'echo' => false,
|
32 |
+
'menu_class' => 'menu amp-menu',
|
33 |
+
'walker' => true
|
34 |
+
);
|
35 |
+
amp_menu(true, $menu_args, 'header' ); ?>
|
|
|
|
|
|
|
|
|
|
|
36 |
</nav>
|
37 |
<?php do_action('ampforwp_after_amp_menu'); ?>
|
38 |
</div>
|
templates/design-manager/design-2/index.php
CHANGED
@@ -31,7 +31,7 @@
|
|
31 |
$paged = 1;
|
32 |
}
|
33 |
|
34 |
-
$exclude_ids =
|
35 |
|
36 |
$args = array(
|
37 |
'post_type' => 'post',
|
31 |
$paged = 1;
|
32 |
}
|
33 |
|
34 |
+
$exclude_ids = ampforwp_exclude_posts();
|
35 |
|
36 |
$args = array(
|
37 |
'post_type' => 'post',
|
templates/design-manager/design-2/search.php
CHANGED
@@ -39,7 +39,7 @@
|
|
39 |
$paged = 1;
|
40 |
}
|
41 |
|
42 |
-
$exclude_ids =
|
43 |
|
44 |
$q = new WP_Query( apply_filters('ampforwp_query_args', array(
|
45 |
's' => get_search_query() ,
|
39 |
$paged = 1;
|
40 |
}
|
41 |
|
42 |
+
$exclude_ids = ampforwp_exclude_posts();
|
43 |
|
44 |
$q = new WP_Query( apply_filters('ampforwp_query_args', array(
|
45 |
's' => get_search_query() ,
|
templates/design-manager/design-3/archive.php
CHANGED
@@ -57,7 +57,7 @@ if ( get_query_var( 'paged' ) ) {
|
|
57 |
<?php $count = 1; ?>
|
58 |
<?php
|
59 |
|
60 |
-
$exclude_ids =
|
61 |
|
62 |
$q = new WP_Query( array(
|
63 |
'post_type' => 'post',
|
57 |
<?php $count = 1; ?>
|
58 |
<?php
|
59 |
|
60 |
+
$exclude_ids = ampforwp_exclude_posts();
|
61 |
|
62 |
$q = new WP_Query( array(
|
63 |
'post_type' => 'post',
|
templates/design-manager/design-3/footer.php
CHANGED
@@ -6,19 +6,13 @@
|
|
6 |
<div class="footer_menu">
|
7 |
<nav>
|
8 |
<?php
|
9 |
-
$
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
$
|
16 |
-
$sanitizer_obj = new AMPFORWP_Content( $menu, array(), apply_filters( 'ampforwp_content_sanitizers', array(
|
17 |
-
'AMP_Img_Sanitizer' => array(),
|
18 |
-
'AMP_Style_Sanitizer' => array(),
|
19 |
-
)) );
|
20 |
-
$sanitized_menu = $sanitizer_obj->get_amp_content();
|
21 |
-
echo wp_kses($sanitized_menu, ampforwp_allowed_tags()); ?>
|
22 |
</nav>
|
23 |
</div>
|
24 |
<?php } ?>
|
6 |
<div class="footer_menu">
|
7 |
<nav>
|
8 |
<?php
|
9 |
+
$menu_args = array(
|
10 |
+
'theme_location' => 'amp-footer-menu',
|
11 |
+
'link_before' => '<span>',
|
12 |
+
'link_after' => '</span>',
|
13 |
+
'echo' => false,
|
14 |
+
);
|
15 |
+
amp_menu( true, $menu_args, 'footer' ); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
</nav>
|
17 |
</div>
|
18 |
<?php } ?>
|
templates/design-manager/design-3/header-bar.php
CHANGED
@@ -14,21 +14,16 @@ if(isset($redux_builder_amp['ampforwp-amp-menu']) && $redux_builder_amp['ampforw
|
|
14 |
<?php // Grand child support AND amp-accordion non critical error in Design 3 due to nav #1152 ?>
|
15 |
<nav id ="primary-amp-menu">
|
16 |
<?php
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
$menu_html_content = apply_filters('ampforwp_menu_content', $menu_html_content);
|
28 |
-
$sanitizer_obj = new AMPFORWP_Content( $menu_html_content, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
|
29 |
-
$sanitized_menu = $sanitizer_obj->get_amp_content();
|
30 |
-
echo $sanitized_menu; // amphtml content, no kses
|
31 |
-
?>
|
32 |
</nav>
|
33 |
<?php }
|
34 |
do_action('ampforwp_after_amp_menu'); ?>
|
14 |
<?php // Grand child support AND amp-accordion non critical error in Design 3 due to nav #1152 ?>
|
15 |
<nav id ="primary-amp-menu">
|
16 |
<?php
|
17 |
+
$menu_args = array(
|
18 |
+
'theme_location' => 'amp-menu',
|
19 |
+
'link_before' => '<span>',
|
20 |
+
'link_after' => '</span>',
|
21 |
+
'menu'=>'ul',
|
22 |
+
'menu_class'=>'amp-menu',
|
23 |
+
'echo'=>false,
|
24 |
+
'walker' => true
|
25 |
+
);
|
26 |
+
amp_menu( true, $menu_args, 'header' ); ?>
|
|
|
|
|
|
|
|
|
|
|
27 |
</nav>
|
28 |
<?php }
|
29 |
do_action('ampforwp_after_amp_menu'); ?>
|
templates/design-manager/design-3/index.php
CHANGED
@@ -119,7 +119,7 @@ if ( get_query_var( 'paged' ) ) {
|
|
119 |
<?php $count = 1; ?>
|
120 |
<?php
|
121 |
|
122 |
-
$exclude_ids =
|
123 |
$args_new = array(
|
124 |
'post_type' => 'post',
|
125 |
'orderby' => 'date',
|
119 |
<?php $count = 1; ?>
|
120 |
<?php
|
121 |
|
122 |
+
$exclude_ids = ampforwp_exclude_posts();
|
123 |
$args_new = array(
|
124 |
'post_type' => 'post',
|
125 |
'orderby' => 'date',
|
templates/design-manager/design-3/search.php
CHANGED
@@ -44,7 +44,7 @@
|
|
44 |
$paged = 1;
|
45 |
}
|
46 |
|
47 |
-
$exclude_ids =
|
48 |
|
49 |
$q = new WP_Query( apply_filters('ampforwp_query_args', array(
|
50 |
's' => get_search_query() ,
|
44 |
$paged = 1;
|
45 |
}
|
46 |
|
47 |
+
$exclude_ids = ampforwp_exclude_posts();
|
48 |
|
49 |
$q = new WP_Query( apply_filters('ampforwp_query_args', array(
|
50 |
's' => get_search_query() ,
|
templates/design-manager/swift/footer.php
CHANGED
@@ -24,20 +24,17 @@ if ( isset($redux_builder_amp['footer-type']) && '1' == $redux_builder_amp['foot
|
|
24 |
<?php endif; ?>
|
25 |
<div class="f-w-f2">
|
26 |
<div class="cntr">
|
27 |
-
<?php if(
|
28 |
<div class="f-menu">
|
29 |
<nav>
|
30 |
<?php
|
31 |
-
$
|
32 |
'theme_location' => 'amp-footer-menu',
|
33 |
'link_before' => '<span>',
|
34 |
'link_after' => '</span>',
|
35 |
'echo' => false
|
36 |
-
)
|
37 |
-
$menu =
|
38 |
-
$sanitizer_obj = new AMPFORWP_Content( $menu, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
|
39 |
-
$sanitized_menu = $sanitizer_obj->get_amp_content();
|
40 |
-
echo $sanitized_menu;// amphtml content, no kses ?>
|
41 |
</nav>
|
42 |
</div>
|
43 |
<?php } }?>
|
24 |
<?php endif; ?>
|
25 |
<div class="f-w-f2">
|
26 |
<div class="cntr">
|
27 |
+
<?php if( ampforwp_get_setting('swift-menu') ){ if ( has_nav_menu( 'amp-footer-menu' ) ) { ?>
|
28 |
<div class="f-menu">
|
29 |
<nav>
|
30 |
<?php
|
31 |
+
$menu_args = array(
|
32 |
'theme_location' => 'amp-footer-menu',
|
33 |
'link_before' => '<span>',
|
34 |
'link_after' => '</span>',
|
35 |
'echo' => false
|
36 |
+
);
|
37 |
+
$menu = amp_menu(true, $menu_args, 'footer'); ?>
|
|
|
|
|
|
|
38 |
</nav>
|
39 |
</div>
|
40 |
<?php } }?>
|
templates/features.php
CHANGED
@@ -129,6 +129,8 @@ add_amp_theme_support('AMP-logo');
|
|
129 |
add_amp_theme_support('AMP-loop');
|
130 |
// GDPR
|
131 |
add_amp_theme_support('AMP-gdpr');
|
|
|
|
|
132 |
// Adding AMP-related things to the main theme
|
133 |
global $redux_builder_amp;
|
134 |
|
@@ -229,40 +231,8 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
|
|
229 |
return;
|
230 |
}
|
231 |
// #872 no-amphtml if selected as hide from settings
|
232 |
-
if(
|
233 |
-
|
234 |
-
$all_tags = get_the_tags();
|
235 |
-
$tagsOnPost = array();
|
236 |
-
if ( $all_tags ) {
|
237 |
-
foreach ($all_tags as $tagskey => $tagsvalue) {
|
238 |
-
$tagsOnPost[] = $tagsvalue->term_id;
|
239 |
-
}
|
240 |
-
}
|
241 |
-
$get_tags_checkbox = array_keys(array_filter($redux_builder_amp['hide-amp-tags-bulk-option']));
|
242 |
-
|
243 |
-
if( count(array_intersect($get_tags_checkbox,$tagsOnPost))>0 ){
|
244 |
-
return;
|
245 |
-
}
|
246 |
-
}//tags area closed
|
247 |
-
|
248 |
-
$selected_cats = $current_cats_ids = array();
|
249 |
-
$get_categories_from_checkbox = ampforwp_get_setting('hide-amp-categories');
|
250 |
-
// Check if $get_categories_from_checkbox has some cats then only show
|
251 |
-
if ( $get_categories_from_checkbox ) {
|
252 |
-
$get_selected_cats = array_filter($get_categories_from_checkbox);
|
253 |
-
foreach ($get_selected_cats as $key => $value) {
|
254 |
-
$selected_cats[] = $key;
|
255 |
-
}
|
256 |
-
$current_cats = get_the_category(get_the_ID());
|
257 |
-
if ( $current_cats ) {
|
258 |
-
foreach ($current_cats as $key => $cats) {
|
259 |
-
$current_cats_ids[] =$cats->cat_ID;
|
260 |
-
}
|
261 |
-
if( count(array_intersect($selected_cats,$current_cats_ids))>0 ){
|
262 |
-
return;
|
263 |
-
}
|
264 |
-
}
|
265 |
-
}
|
266 |
}
|
267 |
if ( is_page() && ! $redux_builder_amp['amp-on-off-for-all-pages'] && ! is_home() && ! is_front_page() ) {
|
268 |
return;
|
@@ -804,41 +774,21 @@ function ampforwp_title_callback( $post ) {
|
|
804 |
$preview_link = $list_of_posts = $skip_this_post = '';
|
805 |
$preview_query_args = array(AMPFORWP_AMP_QUERY_VAR => 1);
|
806 |
$preview_link = get_preview_post_link($post, $preview_query_args );
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
$exclude_post_value = get_option('ampforwp_exclude_post');
|
823 |
-
if ( $exclude_post_value == null ) {
|
824 |
-
$exclude_post_value[] = 0;
|
825 |
-
}
|
826 |
-
if ( $exclude_post_value ) {
|
827 |
-
if ( in_array( $post->ID, $exclude_post_value ) ) {
|
828 |
-
$exclude_ids = array_diff($exclude_post_value, array($post->ID) );
|
829 |
-
update_option('ampforwp_exclude_post', $exclude_ids);
|
830 |
-
}
|
831 |
-
}
|
832 |
-
|
833 |
-
}
|
834 |
-
|
835 |
-
if ( empty( $ampforwp_stored_meta['ampforwp-amp-on-off'][0] ) && $post->post_type == 'page' && ( isset($redux_builder_amp['amp-pages-meta-default']) && $redux_builder_amp['amp-pages-meta-default'] == 'hide' ) ) {
|
836 |
-
$ampforwp_stored_meta['ampforwp-amp-on-off'][0] = 'hide-amp';
|
837 |
-
}
|
838 |
-
$list_of_posts = ampforwp_posts_to_remove();
|
839 |
-
if ( $list_of_posts && $post->post_type == 'post' ) {
|
840 |
-
$ampforwp_stored_meta['ampforwp-amp-on-off'][0] = 'hide-amp';
|
841 |
-
} ?>
|
842 |
<p>
|
843 |
<div class="prfx-row-content">
|
844 |
<label class="meta-radio-two" for="ampforwp-on-off-meta-radio-one">
|
@@ -928,35 +878,7 @@ add_action( 'add_meta_boxes', 'ampforwp_mobile_redirection' );
|
|
928 |
*/
|
929 |
function ampforwp_title_callback_redirection( $post ) {
|
930 |
wp_nonce_field( basename( __FILE__ ), 'ampforwp_title_nonce' );
|
931 |
-
$ampforwp_redirection_stored_meta = get_post_meta( $post->ID )
|
932 |
-
|
933 |
-
// 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()
|
934 |
-
// This code needs a rewrite.
|
935 |
-
if ( !isset($ampforwp_redirection_stored_meta['ampforwp-redirection-on-off'][0]) || $ampforwp_redirection_stored_meta['ampforwp-redirection-on-off'][0] == 'disable') {
|
936 |
-
$exclude_post_value = get_option('ampforwp_exclude_post');
|
937 |
-
if ( $exclude_post_value == null ) {
|
938 |
-
$exclude_post_value[] = 0;
|
939 |
-
}
|
940 |
-
if ( $exclude_post_value ) {
|
941 |
-
if ( ! in_array( $post->ID, $exclude_post_value ) ) {
|
942 |
-
$exclude_post_value[] = $post->ID;
|
943 |
-
update_option('ampforwp_exclude_post', $exclude_post_value);
|
944 |
-
}
|
945 |
-
}
|
946 |
-
} else {
|
947 |
-
$exclude_post_value = get_option('ampforwp_exclude_post');
|
948 |
-
if ( $exclude_post_value == null ) {
|
949 |
-
$exclude_post_value[] = 0;
|
950 |
-
}
|
951 |
-
if ( $exclude_post_value ) {
|
952 |
-
if ( in_array( $post->ID, $exclude_post_value ) ) {
|
953 |
-
$exclude_ids = array_diff($exclude_post_value, array($post->ID) );
|
954 |
-
update_option('ampforwp_exclude_post', $exclude_ids);
|
955 |
-
}
|
956 |
-
}
|
957 |
-
|
958 |
-
}
|
959 |
-
?>
|
960 |
<p>
|
961 |
<div class="prfx-row-content">
|
962 |
<label for="meta-redirection-radio-one">
|
@@ -1054,28 +976,25 @@ function ampforwp_remove_unwanted_scripts() {
|
|
1054 |
}
|
1055 |
// Remove Print Scripts and styles
|
1056 |
function ampforwp_remove_print_scripts() {
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
add_action('wp_print_styles', 'ampforwp_remove_all_styles', 100);
|
1069 |
-
|
1070 |
-
// Remove Print Emoji for Nextgen Gallery support
|
1071 |
-
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
|
1072 |
-
remove_action( 'wp_print_styles', 'print_emoji_styles' );
|
1073 |
-
|
1074 |
|
1075 |
-
|
|
|
|
|
|
|
1076 |
}
|
1077 |
// TODO: Remove this function if its not in use
|
1078 |
-
add_action( 'template_redirect', 'ampforwp_remove_print_scripts' );
|
1079 |
|
1080 |
// 19. Remove Canonical tags
|
1081 |
function ampforwp_amp_remove_actions() {
|
@@ -1195,6 +1114,10 @@ function ampforwp_remove_schema_data() {
|
|
1195 |
remove_filter( 'amp_post_template_file', 'mvp_amp_set_custom_template', 10, 3 );
|
1196 |
remove_action('amp_post_template_head','mvp_amp_google_font');
|
1197 |
|
|
|
|
|
|
|
|
|
1198 |
// Removing Voux theme's lazyloading #2263
|
1199 |
remove_filter( 'the_content', 'thb_lazy_images_filter', 200 );
|
1200 |
remove_filter( 'wp_get_attachment_image_attributes', 'thb_lazy_low_quality', 10, 3 );
|
@@ -2891,18 +2814,26 @@ function ampforwp_auto_add_amp_menu_link_insert() {
|
|
2891 |
}
|
2892 |
|
2893 |
function ampforwp_auto_add_amp_in_link_check() {
|
2894 |
-
global $redux_builder_amp;
|
2895 |
$ampforwp_is_amp_endpoint = ampforwp_is_amp_endpoint();
|
2896 |
-
|
2897 |
-
if ( $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2898 |
add_filter( 'nav_menu_link_attributes', 'ampforwp_auto_add_amp_in_menu_link', 10, 3 );
|
2899 |
}
|
2900 |
}
|
2901 |
|
2902 |
function ampforwp_auto_add_amp_in_menu_link( $atts, $item, $args ) {
|
2903 |
-
|
2904 |
-
|
2905 |
-
if(isset($redux_builder_amp['amp-core-end-point']) && $redux_builder_amp['amp-core-end-point'] == 1){
|
2906 |
$atts['href'] = user_trailingslashit(trailingslashit( $atts['href'] ) );
|
2907 |
$atts['href'] = add_query_arg(AMPFORWP_AMP_QUERY_VAR,'1', $atts['href']);
|
2908 |
}
|
@@ -2974,15 +2905,6 @@ if( !function_exists('ampforwp_checking_any_social_profiles') ) {
|
|
2974 |
// 50. Properly adding noditification Scritps the AMP way
|
2975 |
// Moved to notice-bar-functions.php
|
2976 |
|
2977 |
-
//51. Adding Digg Digg compatibility with AMP
|
2978 |
-
function ampforwp_dd_exclude_from_amp() {
|
2979 |
-
if(ampforwp_is_amp_endpoint()) {
|
2980 |
-
remove_filter('the_excerpt', 'dd_hook_wp_content');
|
2981 |
-
remove_filter('the_content', 'dd_hook_wp_content');
|
2982 |
-
}
|
2983 |
-
}
|
2984 |
-
add_action('template_redirect', 'ampforwp_dd_exclude_from_amp');
|
2985 |
-
|
2986 |
//52. Adding a generalized sanitizer function for purifiying normal html to amp-html
|
2987 |
function ampforwp_content_sanitizer( $content ) {
|
2988 |
$amp_custom_post_content_input = $content;
|
@@ -3687,10 +3609,10 @@ function ampforwp_view_nonamp(){
|
|
3687 |
add_action('init', 'ampforwp_fb_instant_article_feed_generator');
|
3688 |
|
3689 |
function ampforwp_fb_instant_article_feed_generator() {
|
3690 |
-
|
3691 |
-
if( isset($redux_builder_amp['fb-instant-article-switch']) && $redux_builder_amp['fb-instant-article-switch'] ) {
|
3692 |
add_feed('instant_articles', 'ampforwp_fb_instant_article_feed_function');
|
3693 |
add_action( 'wp_head', 'ampforwp_fbia_meta_tags' );
|
|
|
3694 |
}
|
3695 |
}
|
3696 |
|
@@ -3962,43 +3884,15 @@ function ampforwp_rel_canonical_paginated_post(){
|
|
3962 |
add_action('ampforwp_after_post_content','ampforwp_post_pagination');
|
3963 |
|
3964 |
|
3965 |
-
// 70. Hide AMP by specific Categories #872
|
3966 |
-
|
3967 |
function ampforwp_posts_to_remove () {
|
3968 |
-
global $redux_builder_amp;
|
3969 |
-
$get_categories_from_checkbox = $current_cats = '';
|
3970 |
-
$get_selected_cats = array();
|
3971 |
-
$selected_cats = array();
|
3972 |
-
$post_id_array = array();
|
3973 |
-
$current_cats_ids = array();
|
3974 |
if(ampforwp_get_setting('hide-amp-categories2')){
|
3975 |
-
|
3976 |
-
|
3977 |
-
$get_selected_cats = array_filter($get_categories_from_checkbox);
|
3978 |
-
foreach ($get_selected_cats as $key => $value) {
|
3979 |
-
$selected_cats[] = $value;
|
3980 |
-
}
|
3981 |
-
}
|
3982 |
-
$current_cats = get_the_category(get_the_ID());
|
3983 |
-
if ( $current_cats ) {
|
3984 |
-
foreach ($current_cats as $key => $cats) {
|
3985 |
-
$current_cats_ids[] =$cats->cat_ID;
|
3986 |
-
}
|
3987 |
}
|
3988 |
-
if( count(array_intersect($selected_cats,$current_cats_ids))>0 ){
|
3989 |
-
return true;
|
3990 |
-
}
|
3991 |
}
|
3992 |
if( ampforwp_get_setting('hide-amp-tags-bulk-option2') ) {
|
3993 |
-
|
3994 |
-
$all_tags = get_the_tags(get_the_ID());
|
3995 |
-
$tagsOnPost = array();
|
3996 |
-
if ( $all_tags ) {
|
3997 |
-
foreach ($all_tags as $tagskey => $tagsvalue) {
|
3998 |
-
$tagsOnPost[] = $tagsvalue->term_id;
|
3999 |
-
}
|
4000 |
-
}
|
4001 |
-
if( count(array_intersect($get_tags_checkbox,$tagsOnPost))>0 ){
|
4002 |
return true;
|
4003 |
}
|
4004 |
}
|
@@ -4041,11 +3935,13 @@ function ampforwp_cat_specific_skip_amp_post( $skip, $post_id, $post ) {
|
|
4041 |
add_filter('ampforwp_query_args', 'ampforwp_exclude_archive_args');
|
4042 |
function ampforwp_exclude_archive_args( $args ) {
|
4043 |
global $redux_builder_amp;
|
4044 |
-
if (
|
4045 |
-
|
4046 |
-
|
4047 |
-
|
4048 |
-
|
|
|
|
|
4049 |
}
|
4050 |
return $args;
|
4051 |
}
|
@@ -4150,53 +4046,21 @@ global $redux_builder_amp;
|
|
4150 |
}
|
4151 |
return $supported_types;
|
4152 |
}
|
4153 |
-
|
4154 |
-
|
4155 |
function is_category_amp_disabled(){
|
4156 |
-
|
4157 |
-
$current_cats_ids = $selected_cats = array();
|
4158 |
-
if(is_archive() && $redux_builder_amp['ampforwp-archive-support']==1){
|
4159 |
if(is_tag() && is_array(ampforwp_get_setting('hide-amp-tags-bulk-option2') ) ) {
|
4160 |
-
|
4161 |
-
$tagsOnPost = array();
|
4162 |
-
if ( $all_tags ) {
|
4163 |
-
foreach ($all_tags as $tagskey => $tagsvalue) {
|
4164 |
-
$tagsOnPost[] = $tagsvalue->term_id;
|
4165 |
-
}
|
4166 |
-
}
|
4167 |
-
$get_tags_checkbox = array_values(array_filter(ampforwp_get_setting('hide-amp-tags-bulk-option2')));
|
4168 |
-
|
4169 |
-
if( count(array_intersect($get_tags_checkbox,$tagsOnPost))>0 ){
|
4170 |
return true;
|
4171 |
}
|
4172 |
-
else{
|
4173 |
-
return false;
|
4174 |
-
}
|
4175 |
}//tags check area closed
|
4176 |
-
if ( is_category() ) {
|
4177 |
-
|
4178 |
-
|
4179 |
-
$get_categories_from_checkbox = ampforwp_get_setting('hide-amp-categories2');
|
4180 |
-
// Check if $get_categories_from_checkbox has some cats then only show
|
4181 |
-
if ( $get_categories_from_checkbox ) {
|
4182 |
-
$get_selected_cats = array_filter($get_categories_from_checkbox);
|
4183 |
-
foreach ($get_selected_cats as $key => $value) {
|
4184 |
-
$selected_cats[] = $value;
|
4185 |
-
}
|
4186 |
-
foreach ($categories as $key => $cats) {
|
4187 |
-
$current_cats_ids[] =$cats->cat_ID;
|
4188 |
-
}
|
4189 |
-
if($selected_cats && $current_cats_ids){
|
4190 |
-
if( count(array_intersect($selected_cats,$current_cats_ids))>0 ){
|
4191 |
-
return true;
|
4192 |
-
}
|
4193 |
-
else
|
4194 |
-
return false;
|
4195 |
-
}
|
4196 |
-
}
|
4197 |
}
|
4198 |
}
|
4199 |
}
|
|
|
4200 |
}
|
4201 |
|
4202 |
// 73. View AMP Site below View Site In Dashboard #1076
|
@@ -4981,20 +4845,6 @@ if( ! function_exists( 'ampforwp_get_author_details' ) ){
|
|
4981 |
// 89. Facebook Pixel
|
4982 |
// Moved to analytics-functions.php
|
4983 |
|
4984 |
-
//90. Set Header last modified information
|
4985 |
-
add_action('template_redirect', 'ampforwp_addAmpLastModifiedHeader', 12);
|
4986 |
-
function ampforwp_addAmpLastModifiedHeader($headers) {
|
4987 |
-
|
4988 |
-
//Check if we are in a single post of any type (archive pages has not modified date)
|
4989 |
-
$ampforwp_is_amp_endpoint = ampforwp_is_amp_endpoint();
|
4990 |
-
|
4991 |
-
if( is_singular() && $ampforwp_is_amp_endpoint ) {
|
4992 |
-
$post_id = get_queried_object_id();
|
4993 |
-
if( $post_id ) {
|
4994 |
-
header("Last-Modified: " . get_the_modified_time("D, d M Y H:i:s", $post_id) );
|
4995 |
-
}
|
4996 |
-
}
|
4997 |
-
}
|
4998 |
// 91. Comment Author Gravatar URL
|
4999 |
if( ! function_exists('ampforwp_get_comments_gravatar') ){
|
5000 |
function ampforwp_get_comments_gravatar( $comment ) {
|
129 |
add_amp_theme_support('AMP-loop');
|
130 |
// GDPR
|
131 |
add_amp_theme_support('AMP-gdpr');
|
132 |
+
// Menu
|
133 |
+
add_amp_theme_support('AMP-menu');
|
134 |
// Adding AMP-related things to the main theme
|
135 |
global $redux_builder_amp;
|
136 |
|
231 |
return;
|
232 |
}
|
233 |
// #872 no-amphtml if selected as hide from settings
|
234 |
+
if ( is_category_amp_disabled() ) {
|
235 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
}
|
237 |
if ( is_page() && ! $redux_builder_amp['amp-on-off-for-all-pages'] && ! is_home() && ! is_front_page() ) {
|
238 |
return;
|
774 |
$preview_link = $list_of_posts = $skip_this_post = '';
|
775 |
$preview_query_args = array(AMPFORWP_AMP_QUERY_VAR => 1);
|
776 |
$preview_link = get_preview_post_link($post, $preview_query_args );
|
777 |
+
$exclude_post_value = array();
|
778 |
+
if ( ampforwp_posts_to_remove() && $post->post_type == 'post' ) {
|
779 |
+
$ampforwp_stored_meta['ampforwp-amp-on-off'][0] = 'hide-amp';
|
780 |
+
}
|
781 |
+
$exclude_post_value = ampforwp_exclude_posts();
|
782 |
+
// if hide-amp is selected, add it in the $exclude_post_value
|
783 |
+
if ( 'hide-amp' == $ampforwp_stored_meta['ampforwp-amp-on-off'][0] && 'page' != $post->post_type ) {
|
784 |
+
if ( ! in_array($post->ID, $exclude_post_value) ) {
|
785 |
+
$exclude_post_value[] = $post->ID;
|
786 |
+
set_transient('ampforwp_exclude_post_transient', $exclude_post_value);
|
787 |
+
}
|
788 |
+
}
|
789 |
+
if ( empty( $ampforwp_stored_meta['ampforwp-amp-on-off'][0] ) && $post->post_type == 'page' && ampforwp_get_setting('amp-pages-meta-default') == 'hide' ) {
|
790 |
+
$ampforwp_stored_meta['ampforwp-amp-on-off'][0] = 'hide-amp';
|
791 |
+
}?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
792 |
<p>
|
793 |
<div class="prfx-row-content">
|
794 |
<label class="meta-radio-two" for="ampforwp-on-off-meta-radio-one">
|
878 |
*/
|
879 |
function ampforwp_title_callback_redirection( $post ) {
|
880 |
wp_nonce_field( basename( __FILE__ ), 'ampforwp_title_nonce' );
|
881 |
+
$ampforwp_redirection_stored_meta = get_post_meta( $post->ID );?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
882 |
<p>
|
883 |
<div class="prfx-row-content">
|
884 |
<label for="meta-redirection-radio-one">
|
976 |
}
|
977 |
// Remove Print Scripts and styles
|
978 |
function ampforwp_remove_print_scripts() {
|
979 |
+
if ( ampforwp_is_amp_endpoint() ) {
|
980 |
+
function ampforwp_remove_all_scripts() {
|
981 |
+
global $wp_scripts;
|
982 |
+
$wp_scripts->queue = array();
|
983 |
+
}
|
984 |
+
add_action('wp_print_scripts', 'ampforwp_remove_all_scripts', 100);
|
985 |
+
function ampforwp_remove_all_styles() {
|
986 |
+
global $wp_styles;
|
987 |
+
$wp_styles->queue = array();
|
988 |
+
}
|
989 |
+
add_action('wp_print_styles', 'ampforwp_remove_all_styles', 100);
|
|
|
|
|
|
|
|
|
|
|
|
|
990 |
|
991 |
+
// Remove Print Emoji for Nextgen Gallery support
|
992 |
+
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
|
993 |
+
remove_action( 'wp_print_styles', 'print_emoji_styles' );
|
994 |
+
}
|
995 |
}
|
996 |
// TODO: Remove this function if its not in use
|
997 |
+
// add_action( 'template_redirect', 'ampforwp_remove_print_scripts' );
|
998 |
|
999 |
// 19. Remove Canonical tags
|
1000 |
function ampforwp_amp_remove_actions() {
|
1114 |
remove_filter( 'amp_post_template_file', 'mvp_amp_set_custom_template', 10, 3 );
|
1115 |
remove_action('amp_post_template_head','mvp_amp_google_font');
|
1116 |
|
1117 |
+
// Digg Digg Compatibility
|
1118 |
+
remove_filter('the_excerpt', 'dd_hook_wp_content');
|
1119 |
+
remove_filter('the_content', 'dd_hook_wp_content');
|
1120 |
+
|
1121 |
// Removing Voux theme's lazyloading #2263
|
1122 |
remove_filter( 'the_content', 'thb_lazy_images_filter', 200 );
|
1123 |
remove_filter( 'wp_get_attachment_image_attributes', 'thb_lazy_low_quality', 10, 3 );
|
2814 |
}
|
2815 |
|
2816 |
function ampforwp_auto_add_amp_in_link_check() {
|
|
|
2817 |
$ampforwp_is_amp_endpoint = ampforwp_is_amp_endpoint();
|
2818 |
+
$add_amp_menu = get_transient('ampforwp_auto_add_amp_in_menu_link');
|
2819 |
+
if ( false == $add_amp_menu || ( 'on' && 0 == ampforwp_get_setting('ampforwp-auto-amp-menu-link') ) ) {
|
2820 |
+
delete_transient('ampforwp_header_menu');
|
2821 |
+
delete_transient('ampforwp_footer_menu');
|
2822 |
+
set_transient('ampforwp_auto_add_amp_in_menu_link', 'off');
|
2823 |
+
}
|
2824 |
+
if ( $ampforwp_is_amp_endpoint && ampforwp_get_setting('ampforwp-auto-amp-menu-link') == 1 ) {
|
2825 |
+
if( 'off' == $add_amp_menu ) {
|
2826 |
+
delete_transient('ampforwp_header_menu');
|
2827 |
+
delete_transient('ampforwp_footer_menu');
|
2828 |
+
set_transient('ampforwp_auto_add_amp_in_menu_link', 'on');
|
2829 |
+
}
|
2830 |
add_filter( 'nav_menu_link_attributes', 'ampforwp_auto_add_amp_in_menu_link', 10, 3 );
|
2831 |
}
|
2832 |
}
|
2833 |
|
2834 |
function ampforwp_auto_add_amp_in_menu_link( $atts, $item, $args ) {
|
2835 |
+
|
2836 |
+
if(ampforwp_get_setting('amp-core-end-point') == 1 ){
|
|
|
2837 |
$atts['href'] = user_trailingslashit(trailingslashit( $atts['href'] ) );
|
2838 |
$atts['href'] = add_query_arg(AMPFORWP_AMP_QUERY_VAR,'1', $atts['href']);
|
2839 |
}
|
2905 |
// 50. Properly adding noditification Scritps the AMP way
|
2906 |
// Moved to notice-bar-functions.php
|
2907 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2908 |
//52. Adding a generalized sanitizer function for purifiying normal html to amp-html
|
2909 |
function ampforwp_content_sanitizer( $content ) {
|
2910 |
$amp_custom_post_content_input = $content;
|
3609 |
add_action('init', 'ampforwp_fb_instant_article_feed_generator');
|
3610 |
|
3611 |
function ampforwp_fb_instant_article_feed_generator() {
|
3612 |
+
if( ampforwp_get_setting('fb-instant-article-switch') ) {
|
|
|
3613 |
add_feed('instant_articles', 'ampforwp_fb_instant_article_feed_function');
|
3614 |
add_action( 'wp_head', 'ampforwp_fbia_meta_tags' );
|
3615 |
+
require AMPFORWP_PLUGIN_DIR . '/templates/instant-articles/instant-article-sanitizer.php';
|
3616 |
}
|
3617 |
}
|
3618 |
|
3884 |
add_action('ampforwp_after_post_content','ampforwp_post_pagination');
|
3885 |
|
3886 |
|
3887 |
+
// 70. Hide AMP by specific Categories & Tags #872
|
|
|
3888 |
function ampforwp_posts_to_remove () {
|
|
|
|
|
|
|
|
|
|
|
|
|
3889 |
if(ampforwp_get_setting('hide-amp-categories2')){
|
3890 |
+
if ( has_category(array_filter(ampforwp_get_setting('hide-amp-categories2'))) ) {
|
3891 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3892 |
}
|
|
|
|
|
|
|
3893 |
}
|
3894 |
if( ampforwp_get_setting('hide-amp-tags-bulk-option2') ) {
|
3895 |
+
if ( has_tag(array_filter(ampforwp_get_setting('hide-amp-tags-bulk-option2') )) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3896 |
return true;
|
3897 |
}
|
3898 |
}
|
3935 |
add_filter('ampforwp_query_args', 'ampforwp_exclude_archive_args');
|
3936 |
function ampforwp_exclude_archive_args( $args ) {
|
3937 |
global $redux_builder_amp;
|
3938 |
+
if ( ampforwp_is_home() || ampforwp_is_blog() ) {
|
3939 |
+
if ( ampforwp_exclude_archive() ) {
|
3940 |
+
$args['category__not_in'] = ampforwp_exclude_archive();
|
3941 |
+
}
|
3942 |
+
if ( ampforwp_exclude_archive('tag') ) {
|
3943 |
+
$args['tag__not_in'] = ampforwp_exclude_archive('tag');
|
3944 |
+
}
|
3945 |
}
|
3946 |
return $args;
|
3947 |
}
|
4046 |
}
|
4047 |
return $supported_types;
|
4048 |
}
|
4049 |
+
// is_category_amp_disabled #872 & #2549
|
|
|
4050 |
function is_category_amp_disabled(){
|
4051 |
+
if(is_archive() && ampforwp_get_setting('ampforwp-archive-support') ){
|
|
|
|
|
4052 |
if(is_tag() && is_array(ampforwp_get_setting('hide-amp-tags-bulk-option2') ) ) {
|
4053 |
+
if ( in_array(get_query_var( 'tag_id' ), ampforwp_get_setting('hide-amp-tags-bulk-option2')) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4054 |
return true;
|
4055 |
}
|
|
|
|
|
|
|
4056 |
}//tags check area closed
|
4057 |
+
if ( is_category() && is_array(ampforwp_get_setting('hide-amp-categories2')) ) {
|
4058 |
+
if ( in_array(get_query_var( 'cat' ), ampforwp_get_setting('hide-amp-categories2') ) ){
|
4059 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4060 |
}
|
4061 |
}
|
4062 |
}
|
4063 |
+
return false;
|
4064 |
}
|
4065 |
|
4066 |
// 73. View AMP Site below View Site In Dashboard #1076
|
4845 |
// 89. Facebook Pixel
|
4846 |
// Moved to analytics-functions.php
|
4847 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4848 |
// 91. Comment Author Gravatar URL
|
4849 |
if( ! function_exists('ampforwp_get_comments_gravatar') ){
|
4850 |
function ampforwp_get_comments_gravatar( $comment ) {
|
templates/woo-widget.php
CHANGED
@@ -39,8 +39,7 @@ class AMPFORWP_Woo_Widget extends WP_Widget {
|
|
39 |
$ampforwp_number_of_products = $instance[ 'num_of_products' ];
|
40 |
$ampforwp_show_price = $instance[ 'show_price' ];
|
41 |
|
42 |
-
$exclude_ids =
|
43 |
-
$exclude_ids = (array) $exclude_ids;
|
44 |
|
45 |
$q = new WP_Query( array(
|
46 |
'post_type' => 'product',
|
39 |
$ampforwp_number_of_products = $instance[ 'num_of_products' ];
|
40 |
$ampforwp_show_price = $instance[ 'show_price' ];
|
41 |
|
42 |
+
$exclude_ids = ampforwp_exclude_posts();
|
|
|
43 |
|
44 |
$q = new WP_Query( array(
|
45 |
'post_type' => 'product',
|