Version Description
- View more details at https://ampforwp.com/0-9-40-released-biggest-stability-update/
- Proper endpoints added [Improvement]
- Flush Rewrites properly [Improvement]
- REL Canonical properly getting added. [Improvement]
- Proper Frontpage Canonical added [Improvement]
- Added Base name support for categories and tags [Improvement]
- Redirection of excluded post solved. [Bug fix]
- Archives properly redirecting to the right URL [Bug fix]
- Homepage redirection solved [Bug fix]
- Plusone tag is stripped properly. [Validation Issue fixed]
- Archives are now clickable. [Improvements]
- WP_Query filter added for better customizability of Homepage loop. [Better Customizations]
- Social share boost plugin compatibility. [3rd party Customizations]
- Removed H1 from the frontpage even if it is not available. [Improvement]
- H3 instead of H1 for Site title. So there is only one H1 per page. [SEO Improvement]
Download this release
Release Info
Developer | mohammed_kaludi |
Plugin | AMP for WP – Accelerated Mobile Pages |
Version | 0.9.40 |
Comparing to | |
See all releases |
Code changes from version 0.9.38 to 0.9.40
- accelerated-moblie-pages.php +81 -6
- includes/disqus.php +92 -0
- includes/options/admin-config.php +53 -2
- includes/redirect.php +23 -64
- readme.txt +18 -1
- templates/design-manager/design-1/archive.php +9 -8
- templates/design-manager/design-1/elements/comments.php +2 -1
- templates/design-manager/design-1/elements/meta-taxonomy.php +11 -3
- templates/design-manager/design-1/elements/simple-comment-button.php +4 -2
- templates/design-manager/design-1/frontpage.php +8 -8
- templates/design-manager/design-1/index.php +8 -3
- templates/design-manager/design-1/single.php +7 -7
- templates/design-manager/design-1/style.php +7 -0
- templates/design-manager/design-2/archive.php +4 -3
- templates/design-manager/design-2/elements/comments.php +2 -1
- templates/design-manager/design-2/elements/content.php +9 -5
- templates/design-manager/design-2/elements/meta-info.php +6 -2
- templates/design-manager/design-2/elements/meta-taxonomy.php +5 -1
- templates/design-manager/design-2/elements/simple-comment-button.php +4 -2
- templates/design-manager/design-2/frontpage.php +9 -13
- templates/design-manager/design-2/header-bar.php +1 -1
- templates/design-manager/design-2/index.php +7 -3
- templates/design-manager/design-2/single.php +10 -10
- templates/design-manager/design-2/style.php +1 -1
- templates/features.php +90 -17
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.
|
7 |
Author: Ahmed Kaludi, Mohammed Kaludi
|
8 |
Author URI: https://ampforwp.com/
|
9 |
Donate link: https://www.paypal.me/Kaludi/5
|
@@ -13,19 +13,94 @@ License: GPL2
|
|
13 |
// Exit if accessed directly.
|
14 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
15 |
|
|
|
|
|
|
|
|
|
16 |
// Rewrite the Endpoints after the plugin is activate, as priority is set to 11
|
17 |
function ampforwp_add_custom_post_support() {
|
18 |
global $redux_builder_amp;
|
19 |
if( $redux_builder_amp['amp-on-off-for-all-pages'] ) {
|
20 |
-
add_rewrite_endpoint( AMP_QUERY_VAR,
|
21 |
add_post_type_support( 'page', AMP_QUERY_VAR );
|
22 |
}
|
23 |
}
|
24 |
add_action( 'init', 'ampforwp_add_custom_post_support',11);
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
// Redux panel inclusion code
|
31 |
if ( !class_exists( 'ReduxFramework' ) ) {
|
@@ -112,7 +187,7 @@ if ( is_admin() ) {
|
|
112 |
if (!isset($plugin))
|
113 |
$plugin = plugin_basename(__FILE__);
|
114 |
if ($plugin == $plugin_file) {
|
115 |
-
$settings = array('settings' => '<a href="admin.php?page=amp_options&tab=8">' . __('Settings', 'ampforwp') . '</a> | <a href="
|
116 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
117 |
if ( is_plugin_active( 'amp/amp.php' ) ) {
|
118 |
//if parent plugin is activated
|
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.40
|
7 |
Author: Ahmed Kaludi, Mohammed Kaludi
|
8 |
Author URI: https://ampforwp.com/
|
9 |
Donate link: https://www.paypal.me/Kaludi/5
|
13 |
// Exit if accessed directly.
|
14 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
15 |
|
16 |
+
define('AMPFORWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
|
17 |
+
define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
|
18 |
+
define('AMPFORWP_VERSION','0.9.40');
|
19 |
+
|
20 |
// Rewrite the Endpoints after the plugin is activate, as priority is set to 11
|
21 |
function ampforwp_add_custom_post_support() {
|
22 |
global $redux_builder_amp;
|
23 |
if( $redux_builder_amp['amp-on-off-for-all-pages'] ) {
|
24 |
+
add_rewrite_endpoint( AMP_QUERY_VAR, EP_PAGES | EP_PERMALINK | EP_ALL_ARCHIVES | EP_ROOT );
|
25 |
add_post_type_support( 'page', AMP_QUERY_VAR );
|
26 |
}
|
27 |
}
|
28 |
add_action( 'init', 'ampforwp_add_custom_post_support',11);
|
29 |
|
30 |
+
// Add Custom Rewrite Rule to make sure pagination & redirection is working correctly
|
31 |
+
function ampforwp_add_custom_rewrite_rules() {
|
32 |
+
// For Homepage
|
33 |
+
add_rewrite_rule(
|
34 |
+
'amp/?$',
|
35 |
+
'index.php?amp',
|
36 |
+
'top'
|
37 |
+
);
|
38 |
+
// For Homepage with Pagination
|
39 |
+
add_rewrite_rule(
|
40 |
+
'amp/page/([0-9]{1,})/?$',
|
41 |
+
'index.php?amp&paged=$matches[1]',
|
42 |
+
'top'
|
43 |
+
);
|
44 |
+
|
45 |
+
// For category pages
|
46 |
+
$rewrite_category = get_option('category_base');
|
47 |
+
if (! empty($rewrite_category)) {
|
48 |
+
$rewrite_category = get_option('category_base');
|
49 |
+
} else {
|
50 |
+
$rewrite_category = 'category';
|
51 |
+
}
|
52 |
+
|
53 |
+
add_rewrite_rule(
|
54 |
+
$rewrite_category.'\/(.+?)\/amp/?$',
|
55 |
+
'index.php?amp&category_name=$matches[1]',
|
56 |
+
'top'
|
57 |
+
);
|
58 |
+
// For category pages with Pagination
|
59 |
+
add_rewrite_rule(
|
60 |
+
$rewrite_category.'\/(.+?)\/amp\/page\/?([0-9]{1,})\/?$',
|
61 |
+
'index.php?amp&category_name=$matches[1]&paged=$matches[2]',
|
62 |
+
'top'
|
63 |
+
);
|
64 |
+
|
65 |
+
// For tag pages
|
66 |
+
$rewrite_tag = get_option('tag_base');
|
67 |
+
if (! empty($rewrite_tag)) {
|
68 |
+
$rewrite_tag = get_option('tag_base');
|
69 |
+
} else {
|
70 |
+
$rewrite_tag = 'tag';
|
71 |
+
}
|
72 |
+
add_rewrite_rule(
|
73 |
+
$rewrite_tag.'\/(.+?)\/amp/?$',
|
74 |
+
'index.php?amp&tag=$matches[1]',
|
75 |
+
'top'
|
76 |
+
);
|
77 |
+
// For tag pages with Pagination
|
78 |
+
add_rewrite_rule(
|
79 |
+
$rewrite_tag.'\/(.+?)\/amp\/page\/?([0-9]{1,})\/?$',
|
80 |
+
'index.php?amp&tag=$matches[1]&paged=$matches[2]',
|
81 |
+
'top'
|
82 |
+
);
|
83 |
+
|
84 |
+
}
|
85 |
+
add_action( 'init', 'ampforwp_add_custom_rewrite_rules' );
|
86 |
+
|
87 |
+
register_activation_hook( __FILE__, 'ampforwp_rewrite_activation', 20 );
|
88 |
+
function ampforwp_rewrite_activation() {
|
89 |
+
|
90 |
+
ampforwp_add_custom_post_support();
|
91 |
+
ampforwp_add_custom_rewrite_rules();
|
92 |
+
// Flushing rewrite urls ONLY on activation
|
93 |
+
global $wp_rewrite;
|
94 |
+
$wp_rewrite->flush_rules();
|
95 |
+
|
96 |
+
}
|
97 |
+
|
98 |
+
register_deactivation_hook( __FILE__, 'ampforwp_rewrite_deactivate', 20 );
|
99 |
+
function ampforwp_rewrite_deactivate() {
|
100 |
+
// Flushing rewrite urls ONLY on deactivation
|
101 |
+
global $wp_rewrite;
|
102 |
+
$wp_rewrite->flush_rules();
|
103 |
+
}
|
104 |
|
105 |
// Redux panel inclusion code
|
106 |
if ( !class_exists( 'ReduxFramework' ) ) {
|
187 |
if (!isset($plugin))
|
188 |
$plugin = plugin_basename(__FILE__);
|
189 |
if ($plugin == $plugin_file) {
|
190 |
+
$settings = array('settings' => '<a href="admin.php?page=amp_options&tab=8">' . __('Settings', 'ampforwp') . '</a> | <a href="https://ampforwp.com/priority-support/#utm_source=options-panel&utm_medium=extension-tab_priority_support&utm_campaign=AMP%20Plugin">' . __('Premium Support', 'ampforwp') . '</a>');
|
191 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
192 |
if ( is_plugin_active( 'amp/amp.php' ) ) {
|
193 |
//if parent plugin is activated
|
includes/disqus.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="disqus_thread"></div>
|
2 |
+
<script>
|
3 |
+
|
4 |
+
var QueryString = function () {
|
5 |
+
var query_string = {};
|
6 |
+
var query = window.location.search.substring(1);
|
7 |
+
var vars = query.split("&");
|
8 |
+
for (var i=0;i<vars.length;i++) {
|
9 |
+
var pair = vars[i].split("=");
|
10 |
+
if (typeof query_string[pair[0]] === "undefined") {
|
11 |
+
query_string[pair[0]] = decodeURIComponent(pair[1]);
|
12 |
+
} else if (typeof query_string[pair[0]] === "string") {
|
13 |
+
var arr = [ query_string[pair[0]],decodeURIComponent(pair[1]) ];
|
14 |
+
query_string[pair[0]] = arr;
|
15 |
+
} else {
|
16 |
+
query_string[pair[0]].push(decodeURIComponent(pair[1]));
|
17 |
+
}
|
18 |
+
}
|
19 |
+
return query_string;
|
20 |
+
}();
|
21 |
+
|
22 |
+
var url = QueryString.url;
|
23 |
+
var identifier = QueryString.identifier;
|
24 |
+
var disqus_name = QueryString.disqus_name;
|
25 |
+
var disqus_title = QueryString.disqus_title;
|
26 |
+
|
27 |
+
var disqus_config = function () {
|
28 |
+
this.page.url = url;
|
29 |
+
this.page.title = disqus_title;
|
30 |
+
this.page.identifier = identifier || url;
|
31 |
+
};
|
32 |
+
|
33 |
+
(function () {
|
34 |
+
var d = document, s = d.createElement('script');
|
35 |
+
s.src = disqus_name;
|
36 |
+
s.setAttribute('data-timestamp', +new Date());
|
37 |
+
(d.head || d.body).appendChild(s);
|
38 |
+
})();
|
39 |
+
|
40 |
+
(function () {
|
41 |
+
function checkSizeChange() {
|
42 |
+
var viewportHeight = window.innerHeight;
|
43 |
+
var contentHeight = document.getElementById('disqus_thread').clientHeight;
|
44 |
+
if (viewportHeight !== contentHeight && contentHeight > 100) {
|
45 |
+
window.parent.postMessage({
|
46 |
+
sentinel: 'amp',
|
47 |
+
type: 'embed-size',
|
48 |
+
height: contentHeight
|
49 |
+
}, '*')
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
var mutationObserverAvailable = typeof window.MutationObserver === 'function';
|
54 |
+
|
55 |
+
function bindObserver() {
|
56 |
+
var foundframe = false,
|
57 |
+
frame, framename,
|
58 |
+
frames = document.getElementsByTagName('iframe');
|
59 |
+
|
60 |
+
for (var i=0; i < frames.length; ++i) {
|
61 |
+
frame = frames[i];
|
62 |
+
framename = frame.getAttribute("name");
|
63 |
+
if ( framename && /dsq/.test(framename) ) {
|
64 |
+
// check the size now since the frame is now available
|
65 |
+
checkSizeChange();
|
66 |
+
|
67 |
+
var resizeObserver = new MutationObserver(checkSizeChange);
|
68 |
+
resizeObserver.observe(frame, {
|
69 |
+
attributes: true,
|
70 |
+
attributeFilter: ['style']
|
71 |
+
});
|
72 |
+
foundframe = true;
|
73 |
+
break;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
// if the frame is not available yet try again later
|
78 |
+
if (foundframe === false) {
|
79 |
+
setTimeout(bindObserver, 200);
|
80 |
+
return;
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
// use mutation observers to quickly change the size of the iframe
|
85 |
+
if (mutationObserverAvailable) {
|
86 |
+
bindObserver();
|
87 |
+
}
|
88 |
+
|
89 |
+
// also check periodically for the size of the frame
|
90 |
+
setInterval(checkSizeChange, mutationObserverAvailable ? 5000 : 500);
|
91 |
+
})();
|
92 |
+
</script>
|
includes/options/admin-config.php
CHANGED
@@ -987,6 +987,50 @@ Redux::setArgs( "redux_builder_amp", $args );
|
|
987 |
//
|
988 |
|
989 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
990 |
// Advance Settings SECTION
|
991 |
Redux::setSection( $opt_name, array(
|
992 |
'title' => __( 'Advance Settings', 'redux-framework-demo' ),
|
@@ -994,14 +1038,21 @@ Redux::setSection( $opt_name, array(
|
|
994 |
'id' => 'amp-advance',
|
995 |
'subsection' => true,
|
996 |
'fields' => array(
|
997 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
998 |
'id' => 'ampforwp-homepage-on-off-support',
|
999 |
'type' => 'switch',
|
1000 |
'title' => __('Homepage Support', 'redux-framework-demo'),
|
1001 |
'subtitle' => __('Enable/Disable Home page using this switch.', 'redux-framework-demo'),
|
1002 |
'default' => '1'
|
1003 |
),
|
1004 |
-
|
1005 |
'id' => 'ampforwp-archive-support',
|
1006 |
'type' => 'switch',
|
1007 |
'title' => __('Archive page Support', 'redux-framework-demo'),
|
987 |
//
|
988 |
|
989 |
|
990 |
+
// Disqus Comments
|
991 |
+
// Redux::setSection( $opt_name, array(
|
992 |
+
// 'title' => __( 'Disqus Comments', 'redux-framework-demo' ),
|
993 |
+
// 'desc' => '<a href="https://github.com/disqus/disqus-install-examples/tree/master/google-amp"> Link to Official Disqus documentation. </a>',
|
994 |
+
// 'id' => 'disqus-comments',
|
995 |
+
// 'subsection' => true,
|
996 |
+
// 'fields' => array(
|
997 |
+
// array(
|
998 |
+
// 'id' => 'ampforwp-disqus-comments-support',
|
999 |
+
// 'type' => 'switch',
|
1000 |
+
// 'title' => __('Disqus comments Support', 'redux-framework-demo'),
|
1001 |
+
// 'subtitle' => __('Enable/Disable Disqus comments using this switch.', 'redux-framework-demo'),
|
1002 |
+
// 'default' => 0
|
1003 |
+
// ),
|
1004 |
+
// array(
|
1005 |
+
// 'id' => 'ampforwp-disqus-comments-name',
|
1006 |
+
// 'type' => 'text',
|
1007 |
+
// 'title' => __('Disqus Name', 'redux-framework-demo'),
|
1008 |
+
// 'subtitle' => __('Eg: https://xyz.disqus.com', 'redux-framework-demo'),
|
1009 |
+
// 'required' => array('ampforwp-disqus-comments-support', '=' , '1'),
|
1010 |
+
// ),
|
1011 |
+
|
1012 |
+
// array(
|
1013 |
+
// 'id' => 'ampforwp-disqus-host-position',
|
1014 |
+
// 'type' => 'switch',
|
1015 |
+
// 'title' => __('Host Disqus Comments through AMPforWP Servers', 'redux-framework-demo'),
|
1016 |
+
// 'subtitle' => __('Use AMPforWP secure servers to serve Comments file. Recommended if your site is non HTTPS', 'redux-framework-demo'),
|
1017 |
+
// 'default' => 1,
|
1018 |
+
// 'required' => array('ampforwp-disqus-comments-support', '=' , '1'),
|
1019 |
+
// ),
|
1020 |
+
|
1021 |
+
// array(
|
1022 |
+
// 'id' => 'ampforwp-disqus-host-file',
|
1023 |
+
// 'type' => 'text',
|
1024 |
+
// 'title' => __('Disqus Host File', 'redux-framework-demo'),
|
1025 |
+
// 'subtitle' => __('<a href="#"> Click here to know, How to Setup Disqus Host file on your servers </a>', 'redux-framework-demo'),
|
1026 |
+
// 'placeholder' => 'https://comments.example.com/disqus.php',
|
1027 |
+
// 'required' => array('ampforwp-disqus-host-position', '=' , '0'),
|
1028 |
+
// ),
|
1029 |
+
// )
|
1030 |
+
// ) );
|
1031 |
+
|
1032 |
+
|
1033 |
+
|
1034 |
// Advance Settings SECTION
|
1035 |
Redux::setSection( $opt_name, array(
|
1036 |
'title' => __( 'Advance Settings', 'redux-framework-demo' ),
|
1038 |
'id' => 'amp-advance',
|
1039 |
'subsection' => true,
|
1040 |
'fields' => array(
|
1041 |
+
array(
|
1042 |
+
'id' =>'ampforwp-amp-on-off-catgs-tags',
|
1043 |
+
'type' => 'switch',
|
1044 |
+
'title' => __('Non-AMP links on Meta Archives', 'redux-framework-demo'),
|
1045 |
+
'default' => 0,
|
1046 |
+
'subtitle' => __('Disable/Enable AMP links on Archives Meta', 'redux-framework-demo'),
|
1047 |
+
),
|
1048 |
+
array(
|
1049 |
'id' => 'ampforwp-homepage-on-off-support',
|
1050 |
'type' => 'switch',
|
1051 |
'title' => __('Homepage Support', 'redux-framework-demo'),
|
1052 |
'subtitle' => __('Enable/Disable Home page using this switch.', 'redux-framework-demo'),
|
1053 |
'default' => '1'
|
1054 |
),
|
1055 |
+
array(
|
1056 |
'id' => 'ampforwp-archive-support',
|
1057 |
'type' => 'switch',
|
1058 |
'title' => __('Archive page Support', 'redux-framework-demo'),
|
includes/redirect.php
CHANGED
@@ -4,22 +4,13 @@ function ampforwp_check_amp_page_status() {
|
|
4 |
global $redux_builder_amp;
|
5 |
|
6 |
if ( ampforwp_is_amp_endpoint() ) {
|
7 |
-
if (
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
if (is_archive() && $redux_builder_amp['ampforwp-archive-support'] == 0 ) {
|
16 |
-
global $wp;
|
17 |
-
$redirection_location = add_query_arg( '', '', home_url( $wp->request ) );
|
18 |
-
$redirection_location = trailingslashit($redirection_location );
|
19 |
-
$redirection_location = dirname($redirection_location);
|
20 |
-
wp_safe_redirect( $redirection_location );
|
21 |
-
exit;
|
22 |
-
}
|
23 |
}
|
24 |
}
|
25 |
}
|
@@ -48,20 +39,30 @@ function ampforwp_page_template_redirect() {
|
|
48 |
if ( ampforwp_is_amp_endpoint() ) {
|
49 |
return;
|
50 |
} else {
|
|
|
51 |
if( !isset($_SESSION['ampforwp_amp_mode']) || !isset($_GET['nonamp']) ) {
|
52 |
$_SESSION['ampforwp_amp_mode']='mobile-on';
|
53 |
if ( is_home() ) {
|
54 |
-
|
55 |
-
|
|
|
|
|
56 |
}
|
57 |
elseif ( is_archive() ) {
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
62 |
} else {
|
|
|
|
|
|
|
|
|
63 |
wp_redirect( trailingslashit( esc_url( ( get_permalink( $id ) ) ) ) . AMP_QUERY_VAR , 301 );
|
64 |
exit();
|
|
|
65 |
}
|
66 |
}
|
67 |
}
|
@@ -86,45 +87,3 @@ function ampforwp_page_template_redirect_archive() {
|
|
86 |
}
|
87 |
}
|
88 |
}
|
89 |
-
|
90 |
-
// Add Custom Rewrite Rule to make sure pagination & redirection is working correctly
|
91 |
-
function ampforwp_add_custom_rewrite_rules() {
|
92 |
-
// For Homepage
|
93 |
-
add_rewrite_rule(
|
94 |
-
'amp/?$',
|
95 |
-
'index.php?amp',
|
96 |
-
'top'
|
97 |
-
);
|
98 |
-
// For Homepage with Pagination
|
99 |
-
add_rewrite_rule(
|
100 |
-
'amp/page/([0-9]{1,})/?$',
|
101 |
-
'index.php?amp&paged=$matches[1]',
|
102 |
-
'top'
|
103 |
-
);
|
104 |
-
// For category pages
|
105 |
-
add_rewrite_rule(
|
106 |
-
'category\/(.+?)\/amp/?$',
|
107 |
-
'index.php?amp&category_name=$matches[1]',
|
108 |
-
'top'
|
109 |
-
);
|
110 |
-
// For category pages with Pagination
|
111 |
-
add_rewrite_rule(
|
112 |
-
'category\/(.+?)\/amp\/page\/?([0-9]{1,})\/?$',
|
113 |
-
'index.php?amp&category_name=$matches[1]&paged=$matches[2]',
|
114 |
-
'top'
|
115 |
-
);
|
116 |
-
// For tag pages
|
117 |
-
add_rewrite_rule(
|
118 |
-
'tag\/(.+?)\/amp/?$',
|
119 |
-
'index.php?amp&tag=$matches[1]',
|
120 |
-
'top'
|
121 |
-
);
|
122 |
-
// For tag pages with Pagination
|
123 |
-
add_rewrite_rule(
|
124 |
-
'tag\/(.+?)\/amp\/page\/?([0-9]{1,})\/?$',
|
125 |
-
'index.php?amp&tag=$matches[1]&paged=$matches[2]',
|
126 |
-
'top'
|
127 |
-
);
|
128 |
-
|
129 |
-
}
|
130 |
-
add_action( 'init', 'ampforwp_add_custom_rewrite_rules' );
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
}
|
15 |
}
|
16 |
}
|
39 |
if ( ampforwp_is_amp_endpoint() ) {
|
40 |
return;
|
41 |
} else {
|
42 |
+
if(is_page() && $redux_builder_amp['amp-on-off-for-all-pages'] == 0){return;}
|
43 |
if( !isset($_SESSION['ampforwp_amp_mode']) || !isset($_GET['nonamp']) ) {
|
44 |
$_SESSION['ampforwp_amp_mode']='mobile-on';
|
45 |
if ( is_home() ) {
|
46 |
+
if ( $redux_builder_amp['ampforwp-homepage-on-off-support'] == 1 ) {
|
47 |
+
wp_redirect( trailingslashit( esc_url( home_url() ) ) . AMP_QUERY_VAR , 301 );
|
48 |
+
exit();
|
49 |
+
}
|
50 |
}
|
51 |
elseif ( is_archive() ) {
|
52 |
+
if ( $redux_builder_amp['ampforwp-archive-support'] == 1 ) {
|
53 |
+
global $wp;
|
54 |
+
$current_archive_url = home_url( $wp->request );
|
55 |
+
wp_redirect( trailingslashit( esc_url( $current_archive_url ) ) . AMP_QUERY_VAR , 301 );
|
56 |
+
exit();
|
57 |
+
}
|
58 |
} else {
|
59 |
+
$ampforwp_amp_post_on_off_meta = get_post_meta( get_the_ID(),'ampforwp-amp-on-off',true);
|
60 |
+
if( $ampforwp_amp_post_on_off_meta === 'hide-amp' ) {
|
61 |
+
//dont Echo anything
|
62 |
+
} else {
|
63 |
wp_redirect( trailingslashit( esc_url( ( get_permalink( $id ) ) ) ) . AMP_QUERY_VAR , 301 );
|
64 |
exit();
|
65 |
+
}
|
66 |
}
|
67 |
}
|
68 |
}
|
87 |
}
|
88 |
}
|
89 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
|
|
4 |
Donate link: https://www.paypal.me/Kaludi/5
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 4.7.2
|
7 |
-
Stable tag: 0.9.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -124,6 +124,23 @@ You can contact me using this url: http://ampforwp.com/contact/
|
|
124 |
|
125 |
== Changelog ==
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
= 0.9.38 =
|
128 |
* View full details at https://ampforwp.com/google-tag-manager-for-amp/
|
129 |
* Google Tag manager included [New feature]
|
4 |
Donate link: https://www.paypal.me/Kaludi/5
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 4.7.2
|
7 |
+
Stable tag: 0.9.40
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
124 |
|
125 |
== Changelog ==
|
126 |
|
127 |
+
= 0.9.40 =
|
128 |
+
* View more details at https://ampforwp.com/0-9-40-released-biggest-stability-update/
|
129 |
+
* Proper endpoints added [Improvement]
|
130 |
+
* Flush Rewrites properly [Improvement]
|
131 |
+
* REL Canonical properly getting added. [Improvement]
|
132 |
+
* Proper Frontpage Canonical added [Improvement]
|
133 |
+
* Added Base name support for categories and tags [Improvement]
|
134 |
+
* Redirection of excluded post solved. [Bug fix]
|
135 |
+
* Archives properly redirecting to the right URL [Bug fix]
|
136 |
+
* Homepage redirection solved [Bug fix]
|
137 |
+
* Plusone tag is stripped properly. [Validation Issue fixed]
|
138 |
+
* Archives are now clickable. [Improvements]
|
139 |
+
* WP_Query filter added for better customizability of Homepage loop. [Better Customizations]
|
140 |
+
* Social share boost plugin compatibility. [3rd party Customizations]
|
141 |
+
* Removed H1 from the frontpage even if it is not available. [Improvement]
|
142 |
+
* H3 instead of H1 for Site title. So there is only one H1 per page. [SEO Improvement]
|
143 |
+
|
144 |
= 0.9.38 =
|
145 |
* View full details at https://ampforwp.com/google-tag-manager-for-amp/
|
146 |
* Google Tag manager included [New feature]
|
templates/design-manager/design-1/archive.php
CHANGED
@@ -4,14 +4,15 @@
|
|
4 |
<head>
|
5 |
<meta charset="utf-8">
|
6 |
<link rel="dns-prefetch" href="https://cdn.ampproject.org">
|
7 |
-
<?php
|
8 |
-
global $redux_builder_amp;
|
9 |
-
if ( is_home() || is_front_page() || is_archive() ){
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
15 |
<link rel="canonical" href="<?php echo $amp_url ?>">
|
16 |
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
17 |
<?php do_action( 'amp_post_template_head', $this ); ?>
|
4 |
<head>
|
5 |
<meta charset="utf-8">
|
6 |
<link rel="dns-prefetch" href="https://cdn.ampproject.org">
|
7 |
+
<?php
|
8 |
+
global $redux_builder_amp;
|
9 |
+
if ( is_home() || is_front_page() || is_archive() ){
|
10 |
+
global $wp;
|
11 |
+
$current_archive_url = home_url( $wp->request );
|
12 |
+
$amp_url = trailingslashit($current_archive_url);
|
13 |
+
$remove = '/'. AMP_QUERY_VAR;
|
14 |
+
$amp_url = str_replace($remove, '', $amp_url) ;
|
15 |
+
} ?>
|
16 |
<link rel="canonical" href="<?php echo $amp_url ?>">
|
17 |
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
18 |
<?php do_action( 'amp_post_template_head', $this ); ?>
|
templates/design-manager/design-1/elements/comments.php
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
3 |
return;
|
4 |
}
|
5 |
?>
|
1 |
<?php
|
2 |
+
global $redux_builder_amp;
|
3 |
+
if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support']) {
|
4 |
return;
|
5 |
}
|
6 |
?>
|
templates/design-manager/design-1/elements/meta-taxonomy.php
CHANGED
@@ -7,7 +7,11 @@
|
|
7 |
<div class="amp-wp-meta amp-wp-tax-category">
|
8 |
<span><?php global $redux_builder_amp; printf( __($redux_builder_amp['amp-translator-categories-text'] .' ', 'amp' )); ?></span>
|
9 |
<?php foreach ($ampforwp_categories as $cat ) {
|
10 |
-
|
|
|
|
|
|
|
|
|
11 |
} ?>
|
12 |
</div>
|
13 |
<?php endif; ?>
|
@@ -19,8 +23,12 @@
|
|
19 |
<?php if($redux_builder_amp['amp-rtl-select-option']==0) {
|
20 |
global $redux_builder_amp; printf( __($redux_builder_amp['amp-translator-tags-text'] .' ', 'amp' ));
|
21 |
}
|
22 |
-
foreach ($ampforwp_tags as $tag) {
|
23 |
-
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
if($redux_builder_amp['amp-rtl-select-option']) {
|
26 |
global $redux_builder_amp; printf( __($redux_builder_amp['amp-translator-tags-text'] .' ', 'amp' ));
|
7 |
<div class="amp-wp-meta amp-wp-tax-category">
|
8 |
<span><?php global $redux_builder_amp; printf( __($redux_builder_amp['amp-translator-categories-text'] .' ', 'amp' )); ?></span>
|
9 |
<?php foreach ($ampforwp_categories as $cat ) {
|
10 |
+
if($redux_builder_amp['ampforwp-amp-on-off-catgs-tags']){
|
11 |
+
echo ('<span><a href="'.get_category_link($cat->term_taxonomy_id).'" > '. $cat->name .'</a></span>');
|
12 |
+
} else {
|
13 |
+
echo ('<span><a href="'.trailingslashit(get_category_link($cat->term_taxonomy_id)). AMP_QUERY_VAR .'" > '. $cat->name .'</a></span>');
|
14 |
+
}
|
15 |
} ?>
|
16 |
</div>
|
17 |
<?php endif; ?>
|
23 |
<?php if($redux_builder_amp['amp-rtl-select-option']==0) {
|
24 |
global $redux_builder_amp; printf( __($redux_builder_amp['amp-translator-tags-text'] .' ', 'amp' ));
|
25 |
}
|
26 |
+
foreach ($ampforwp_tags as $tag) {
|
27 |
+
if($redux_builder_amp['ampforwp-amp-on-off-catgs-tags']){
|
28 |
+
echo ('<span><a href="'.trailingslashit(get_tag_link($tag->term_taxonomy_id)).'">'.$tag->name .'</a></span>');
|
29 |
+
} else {
|
30 |
+
echo ('<span><a href="'.trailingslashit(get_tag_link($tag->term_taxonomy_id)).'amp" >'.$tag->name .'</a></span>');
|
31 |
+
}
|
32 |
}
|
33 |
if($redux_builder_amp['amp-rtl-select-option']) {
|
34 |
global $redux_builder_amp; printf( __($redux_builder_amp['amp-translator-tags-text'] .' ', 'amp' ));
|
templates/design-manager/design-1/elements/simple-comment-button.php
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
|
|
|
|
4 |
<div class="comment-button-wrapper ampforwp-comment-button">
|
5 |
<a href="<?php echo get_permalink().'?nonamp=1'.'#commentform' ?>"><?php esc_html_e( $redux_builder_amp['amp-translator-leave-a-comment-text'] ); ?></a>
|
6 |
</div>
|
1 |
<?php
|
2 |
+
global $redux_builder_amp;
|
3 |
+
if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support']) {
|
4 |
+
return;
|
5 |
+
} ?>
|
6 |
<div class="comment-button-wrapper ampforwp-comment-button">
|
7 |
<a href="<?php echo get_permalink().'?nonamp=1'.'#commentform' ?>"><?php esc_html_e( $redux_builder_amp['amp-translator-leave-a-comment-text'] ); ?></a>
|
8 |
</div>
|
templates/design-manager/design-1/frontpage.php
CHANGED
@@ -5,7 +5,7 @@ $template = new AMP_Post_Template( $post_id );?>
|
|
5 |
<html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
|
6 |
<head>
|
7 |
<meta charset="utf-8">
|
8 |
-
<link rel="canonical" href="<?php echo
|
9 |
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
10 |
<?php do_action( 'amp_post_template_head', $this ); ?>
|
11 |
<?php
|
@@ -26,13 +26,13 @@ $template = new AMP_Post_Template( $post_id );?>
|
|
26 |
|
27 |
<article class="amp-wp-article">
|
28 |
|
29 |
-
|
30 |
-
<
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
</
|
35 |
-
|
36 |
|
37 |
<?php do_action( 'ampforwp_after_header', $this ); ?>
|
38 |
|
5 |
<html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
|
6 |
<head>
|
7 |
<meta charset="utf-8">
|
8 |
+
<link rel="canonical" href="<?php echo home_url('/');?>">
|
9 |
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
10 |
<?php do_action( 'amp_post_template_head', $this ); ?>
|
11 |
<?php
|
26 |
|
27 |
<article class="amp-wp-article">
|
28 |
|
29 |
+
<?php if( $redux_builder_amp['ampforwp-title-on-front-page'] ) { ?>
|
30 |
+
<header class="amp-wp-article-header ampforwp-title">
|
31 |
+
<h1 class="amp-wp-title">
|
32 |
+
<?php echo get_the_title( $post_id ) ; ?>
|
33 |
+
</h1>
|
34 |
+
</header>
|
35 |
+
<?php } ?>
|
36 |
|
37 |
<?php do_action( 'ampforwp_after_header', $this ); ?>
|
38 |
|
templates/design-manager/design-1/index.php
CHANGED
@@ -8,7 +8,9 @@
|
|
8 |
if ( is_home() || is_front_page() || ( is_archive() && $redux_builder_amp['ampforwp-archive-support'] ) ){
|
9 |
global $wp;
|
10 |
$current_archive_url = home_url( $wp->request );
|
11 |
-
$amp_url
|
|
|
|
|
12 |
} ?>
|
13 |
<link rel="canonical" href="<?php echo $amp_url ?>">
|
14 |
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
@@ -38,13 +40,16 @@
|
|
38 |
|
39 |
$exclude_ids = get_option('ampforwp_exclude_post');
|
40 |
|
41 |
-
$
|
42 |
'post_type' => 'post',
|
43 |
'orderby' => 'date',
|
44 |
'ignore_sticky_posts' => 1,
|
45 |
'paged' => esc_attr($paged),
|
46 |
'post__not_in' => $exclude_ids
|
47 |
-
)
|
|
|
|
|
|
|
48 |
<?php if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post(); ?>
|
49 |
<div class="amp-wp-content amp-wp-article-header amp-loop-list">
|
50 |
|
8 |
if ( is_home() || is_front_page() || ( is_archive() && $redux_builder_amp['ampforwp-archive-support'] ) ){
|
9 |
global $wp;
|
10 |
$current_archive_url = home_url( $wp->request );
|
11 |
+
$amp_url = trailingslashit($current_archive_url);
|
12 |
+
$remove = '/'. AMP_QUERY_VAR;
|
13 |
+
$amp_url = str_replace($remove, '', $amp_url) ;
|
14 |
} ?>
|
15 |
<link rel="canonical" href="<?php echo $amp_url ?>">
|
16 |
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
40 |
|
41 |
$exclude_ids = get_option('ampforwp_exclude_post');
|
42 |
|
43 |
+
$args = array(
|
44 |
'post_type' => 'post',
|
45 |
'orderby' => 'date',
|
46 |
'ignore_sticky_posts' => 1,
|
47 |
'paged' => esc_attr($paged),
|
48 |
'post__not_in' => $exclude_ids
|
49 |
+
);
|
50 |
+
$filtered_args = apply_filters('ampforwp_query_args', $args);
|
51 |
+
$q = new WP_Query( $filtered_args ); ?>
|
52 |
+
|
53 |
<?php if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post(); ?>
|
54 |
<div class="amp-wp-content amp-wp-article-header amp-loop-list">
|
55 |
|
templates/design-manager/design-1/single.php
CHANGED
@@ -13,17 +13,17 @@
|
|
13 |
|
14 |
<body class="<?php echo esc_attr( $this->get( 'body_class' ) ); ?> single-post <?php if(is_page()){ echo'amp-single-page'; };?>">
|
15 |
|
16 |
-
<?php $this->load_parts( array( 'header-bar' ) ); ?>
|
17 |
|
18 |
-
<article class="amp-wp-article">
|
19 |
-
|
20 |
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
</article>
|
25 |
|
26 |
-
<?php $this->load_parts( array( 'footer' ) ); ?>
|
27 |
|
28 |
<?php do_action( 'amp_post_template_footer', $this ); ?>
|
29 |
|
13 |
|
14 |
<body class="<?php echo esc_attr( $this->get( 'body_class' ) ); ?> single-post <?php if(is_page()){ echo'amp-single-page'; };?>">
|
15 |
|
16 |
+
<?php $this->load_parts( array( 'header-bar' ) ); ?>
|
17 |
|
18 |
+
<article class="amp-wp-article">
|
19 |
+
<?php do_action('ampforwp_post_before_design_elements') ?>
|
20 |
|
21 |
+
<?php $this->load_parts( apply_filters( 'ampforwp_design_elements', array( 'empty-filter' ) ) ); ?>
|
22 |
|
23 |
+
<?php do_action('ampforwp_post_after_design_elements') ?>
|
24 |
+
</article>
|
25 |
|
26 |
+
<?php $this->load_parts( array( 'footer' ) ); ?>
|
27 |
|
28 |
<?php do_action( 'amp_post_template_footer', $this ); ?>
|
29 |
|
templates/design-manager/design-1/style.php
CHANGED
@@ -220,6 +220,13 @@ blockquote p:last-child {
|
|
220 |
.amp-wp-article-content amp-img.alignleft {
|
221 |
margin: 0 16px 1em 0;
|
222 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
/* Captions */
|
224 |
.wp-caption {
|
225 |
padding: 0;
|
220 |
.amp-wp-article-content amp-img.alignleft {
|
221 |
margin: 0 16px 1em 0;
|
222 |
}
|
223 |
+
/* Disqus */
|
224 |
+
.amp-disqus-comments {
|
225 |
+
padding: 15px;
|
226 |
+
}
|
227 |
+
.amp-disqus-comments amp-iframe{
|
228 |
+
background: none;
|
229 |
+
}
|
230 |
/* Captions */
|
231 |
.wp-caption {
|
232 |
padding: 0;
|
templates/design-manager/design-2/archive.php
CHANGED
@@ -8,9 +8,10 @@
|
|
8 |
global $redux_builder_amp;
|
9 |
if ( is_home() || is_front_page() || is_archive() ){
|
10 |
global $wp;
|
11 |
-
$current_archive_url
|
12 |
-
$amp_url
|
13 |
-
$
|
|
|
14 |
} ?>
|
15 |
<link rel="canonical" href="<?php echo $amp_url ?>">
|
16 |
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
8 |
global $redux_builder_amp;
|
9 |
if ( is_home() || is_front_page() || is_archive() ){
|
10 |
global $wp;
|
11 |
+
$current_archive_url = home_url( $wp->request );
|
12 |
+
$amp_url = trailingslashit($current_archive_url);
|
13 |
+
$remove = '/'. AMP_QUERY_VAR;
|
14 |
+
$amp_url = str_replace($remove, '', $amp_url) ;
|
15 |
} ?>
|
16 |
<link rel="canonical" href="<?php echo $amp_url ?>">
|
17 |
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
templates/design-manager/design-2/elements/comments.php
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
3 |
return;
|
4 |
}
|
5 |
?>
|
1 |
<?php
|
2 |
+
global $redux_builder_amp;
|
3 |
+
if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support']) {
|
4 |
return;
|
5 |
}
|
6 |
?>
|
templates/design-manager/design-2/elements/content.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
// Custom/Alternative AMP content added through post meta
|
16 |
echo $this->get( 'ampforwp_amp_content' );
|
17 |
}
|
18 |
-
|
19 |
// echo $this->get( 'post_amp_content' ); // amphtml content; no kses
|
20 |
?>
|
21 |
|
@@ -34,8 +34,10 @@
|
|
34 |
<!--Next Link code-->
|
35 |
<div class="next">
|
36 |
<?php $next_post = get_next_post();
|
37 |
-
if (!empty( $next_post )) {
|
38 |
-
|
|
|
|
|
39 |
} ?>
|
40 |
</div>
|
41 |
<!--Next Link code-->
|
@@ -43,8 +45,10 @@
|
|
43 |
<!--Prev Link code-->
|
44 |
<div class="prev">
|
45 |
<?php $prev_post = get_previous_post();
|
46 |
-
if (!empty( $prev_post )) {
|
47 |
-
|
|
|
|
|
48 |
} ?>
|
49 |
</div>
|
50 |
<!--Prev Link code-->
|
15 |
// Custom/Alternative AMP content added through post meta
|
16 |
echo $this->get( 'ampforwp_amp_content' );
|
17 |
}
|
18 |
+
|
19 |
// echo $this->get( 'post_amp_content' ); // amphtml content; no kses
|
20 |
?>
|
21 |
|
34 |
<!--Next Link code-->
|
35 |
<div class="next">
|
36 |
<?php $next_post = get_next_post();
|
37 |
+
if (!empty( $next_post )) {
|
38 |
+
$next_text = $next_post->post_title;
|
39 |
+
?>
|
40 |
+
<a href="<?php echo trailingslashit(get_permalink( $next_post->ID )) . AMP_QUERY_VAR; ?>"><?php echo apply_filters('ampforwp_next_link',$next_text ); ?> »</a> <?php
|
41 |
} ?>
|
42 |
</div>
|
43 |
<!--Next Link code-->
|
45 |
<!--Prev Link code-->
|
46 |
<div class="prev">
|
47 |
<?php $prev_post = get_previous_post();
|
48 |
+
if (!empty( $prev_post )) {
|
49 |
+
$prev_text = $prev_post->post_title;
|
50 |
+
?>
|
51 |
+
<a href="<?php echo trailingslashit(get_permalink( $prev_post->ID )). AMP_QUERY_VAR; ?>"> « <?php echo apply_filters('ampforwp_prev_link',$prev_text ); ?></a> <?php
|
52 |
} ?>
|
53 |
</div>
|
54 |
<!--Prev Link code-->
|
templates/design-manager/design-2/elements/meta-info.php
CHANGED
@@ -28,8 +28,12 @@
|
|
28 |
}
|
29 |
?>
|
30 |
</span>
|
31 |
-
<?php foreach ($ampforwp_categories as $cat ) {
|
32 |
-
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
|
35 |
//if RTL is ON
|
28 |
}
|
29 |
?>
|
30 |
</span>
|
31 |
+
<?php foreach ($ampforwp_categories as $cat ) {
|
32 |
+
if($redux_builder_amp['ampforwp-amp-on-off-catgs-tags']){
|
33 |
+
echo ('<span><a href="'.get_category_link($cat->term_taxonomy_id).'" >'.$cat->name .'</a></span>');
|
34 |
+
} else {
|
35 |
+
echo ('<span><a href="'.trailingslashit(get_category_link($cat->term_taxonomy_id)).'amp" >'.$cat->name .'</a></span>');
|
36 |
+
}
|
37 |
}
|
38 |
|
39 |
//if RTL is ON
|
templates/design-manager/design-2/elements/meta-taxonomy.php
CHANGED
@@ -10,7 +10,11 @@
|
|
10 |
}
|
11 |
|
12 |
foreach ($ampforwp_tags as $tag) {
|
13 |
-
|
|
|
|
|
|
|
|
|
14 |
}
|
15 |
|
16 |
//if RTL is ON
|
10 |
}
|
11 |
|
12 |
foreach ($ampforwp_tags as $tag) {
|
13 |
+
if($redux_builder_amp['ampforwp-amp-on-off-catgs-tags']){
|
14 |
+
echo ('<span><a href="'.trailingslashit(get_tag_link($tag->term_taxonomy_id)).'">'.$tag->name .'</a></span>');
|
15 |
+
} else {
|
16 |
+
echo ('<span><a href="'.trailingslashit(get_tag_link($tag->term_taxonomy_id)).'amp" >'.$tag->name .'</a></span>');
|
17 |
+
}
|
18 |
}
|
19 |
|
20 |
//if RTL is ON
|
templates/design-manager/design-2/elements/simple-comment-button.php
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
|
|
|
|
4 |
<div class="comment-button-wrapper ampforwp-comment-button">
|
5 |
<a href="<?php echo get_permalink().'?nonamp=1'.'#commentform' ?>"><?php esc_html_e( $redux_builder_amp['amp-translator-leave-a-comment-text'] ); ?></a>
|
6 |
</div>
|
1 |
<?php
|
2 |
+
global $redux_builder_amp;
|
3 |
+
if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support']) {
|
4 |
+
return;
|
5 |
+
} ?>
|
6 |
<div class="comment-button-wrapper ampforwp-comment-button">
|
7 |
<a href="<?php echo get_permalink().'?nonamp=1'.'#commentform' ?>"><?php esc_html_e( $redux_builder_amp['amp-translator-leave-a-comment-text'] ); ?></a>
|
8 |
</div>
|
templates/design-manager/design-2/frontpage.php
CHANGED
@@ -5,9 +5,7 @@ $template = new AMP_Post_Template( $post_id );?>
|
|
5 |
<html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
|
6 |
<head>
|
7 |
<meta charset="utf-8">
|
8 |
-
<link rel="canonical" href="<?php
|
9 |
-
$ID = $redux_builder_amp['amp-frontpage-select-option-pages'];
|
10 |
-
echo get_permalink( $ID ) ?>">
|
11 |
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
12 |
<?php do_action( 'amp_post_template_head', $this ); ?>
|
13 |
<?php
|
@@ -26,16 +24,14 @@ $template = new AMP_Post_Template( $post_id );?>
|
|
26 |
<body class="single-post">
|
27 |
<?php $this->load_parts( array( 'header-bar' ) ); ?>
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
$ID = $redux_builder_amp['amp-frontpage-select-option-pages'];
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
</h1>
|
38 |
-
</header>
|
39 |
|
40 |
<?php do_action( 'ampforwp_after_header', $this ); ?>
|
41 |
|
5 |
<html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
|
6 |
<head>
|
7 |
<meta charset="utf-8">
|
8 |
+
<link rel="canonical" href="<?php echo home_url('/');?>">
|
|
|
|
|
9 |
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
10 |
<?php do_action( 'amp_post_template_head', $this ); ?>
|
11 |
<?php
|
24 |
<body class="single-post">
|
25 |
<?php $this->load_parts( array( 'header-bar' ) ); ?>
|
26 |
|
27 |
+
<?php global $redux_builder_amp; if( $redux_builder_amp['ampforwp-title-on-front-page'] ) { ?>
|
28 |
+
<header class="amp-wp-article-header ampforwp-title">
|
29 |
+
<h1 class="amp-wp-title">
|
30 |
+
<?php $ID = $redux_builder_amp['amp-frontpage-select-option-pages'];
|
31 |
+
echo get_the_title( $ID ) ; ?>
|
32 |
+
</h1>
|
33 |
+
</header>
|
34 |
+
<?php } ?>
|
|
|
|
|
35 |
|
36 |
<?php do_action( 'ampforwp_after_header', $this ); ?>
|
37 |
|
templates/design-manager/design-2/header-bar.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
<amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="190" height="36" alt="logo" class="amp-logo"></amp-img>
|
17 |
</a>
|
18 |
<?php } else { ?>
|
19 |
-
<
|
20 |
<?php } ?>
|
21 |
|
22 |
</div>
|
16 |
<amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="190" height="36" alt="logo" class="amp-logo"></amp-img>
|
17 |
</a>
|
18 |
<?php } else { ?>
|
19 |
+
<h3><a href="<?php echo esc_url( $ampforwp_home_url ); ?>"><?php bloginfo('name'); ?></a></h3>
|
20 |
<?php } ?>
|
21 |
|
22 |
</div>
|
templates/design-manager/design-2/index.php
CHANGED
@@ -9,7 +9,9 @@
|
|
9 |
if ( is_home() || is_front_page() || ( is_archive() && $redux_builder_amp['ampforwp-archive-support'] ) ){
|
10 |
global $wp;
|
11 |
$current_archive_url = home_url( $wp->request );
|
12 |
-
$amp_url
|
|
|
|
|
13 |
} ?>
|
14 |
<link rel="canonical" href="<?php echo $amp_url ?>">
|
15 |
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
@@ -38,13 +40,15 @@
|
|
38 |
|
39 |
$exclude_ids = get_option('ampforwp_exclude_post');
|
40 |
|
41 |
-
$
|
42 |
'post_type' => 'post',
|
43 |
'orderby' => 'date',
|
44 |
'ignore_sticky_posts' => 1,
|
45 |
'paged' => esc_attr($paged),
|
46 |
'post__not_in' => $exclude_ids
|
47 |
-
)
|
|
|
|
|
48 |
|
49 |
<?php if ( is_archive() ) {
|
50 |
the_archive_title( '<h3 class="page-title">', '</h3>' );
|
9 |
if ( is_home() || is_front_page() || ( is_archive() && $redux_builder_amp['ampforwp-archive-support'] ) ){
|
10 |
global $wp;
|
11 |
$current_archive_url = home_url( $wp->request );
|
12 |
+
$amp_url = trailingslashit($current_archive_url);
|
13 |
+
$remove = '/'. AMP_QUERY_VAR;
|
14 |
+
$amp_url = str_replace($remove, '', $amp_url) ;
|
15 |
} ?>
|
16 |
<link rel="canonical" href="<?php echo $amp_url ?>">
|
17 |
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
40 |
|
41 |
$exclude_ids = get_option('ampforwp_exclude_post');
|
42 |
|
43 |
+
$args = array(
|
44 |
'post_type' => 'post',
|
45 |
'orderby' => 'date',
|
46 |
'ignore_sticky_posts' => 1,
|
47 |
'paged' => esc_attr($paged),
|
48 |
'post__not_in' => $exclude_ids
|
49 |
+
);
|
50 |
+
$filtered_args = apply_filters('ampforwp_query_args', $args);
|
51 |
+
$q = new WP_Query( $filtered_args ); ?>
|
52 |
|
53 |
<?php if ( is_archive() ) {
|
54 |
the_archive_title( '<h3 class="page-title">', '</h3>' );
|
templates/design-manager/design-2/single.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php global $redux_builder_amp
|
2 |
<!doctype html>
|
3 |
<html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
|
4 |
<head>
|
@@ -15,16 +15,16 @@
|
|
15 |
<?php $this->load_parts( array( 'header-bar' ) ); ?>
|
16 |
|
17 |
<?php do_action( 'ampforwp_after_header', $this ); ?>
|
18 |
-
<main>
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
</main>
|
|
|
26 |
<?php $this->load_parts( array( 'footer' ) ); ?>
|
27 |
<?php do_action( 'amp_post_template_footer', $this ); ?>
|
28 |
</body>
|
29 |
-
</html>
|
30 |
-
|
1 |
+
<?php global $redux_builder_amp;?>
|
2 |
<!doctype html>
|
3 |
<html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
|
4 |
<head>
|
15 |
<?php $this->load_parts( array( 'header-bar' ) ); ?>
|
16 |
|
17 |
<?php do_action( 'ampforwp_after_header', $this ); ?>
|
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>
|
25 |
+
</main>
|
26 |
+
|
27 |
<?php $this->load_parts( array( 'footer' ) ); ?>
|
28 |
<?php do_action( 'amp_post_template_footer', $this ); ?>
|
29 |
</body>
|
30 |
+
</html>
|
|
templates/design-manager/design-2/style.php
CHANGED
@@ -220,7 +220,7 @@ amp-sidebar {
|
|
220 |
background: #fff;
|
221 |
text-align: center;
|
222 |
}
|
223 |
-
#header
|
224 |
text-align: center;
|
225 |
font-size: 20px;
|
226 |
font-weight: bold;
|
220 |
background: #fff;
|
221 |
text-align: center;
|
222 |
}
|
223 |
+
#header h3{
|
224 |
text-align: center;
|
225 |
font-size: 20px;
|
226 |
font-weight: bold;
|
templates/features.php
CHANGED
@@ -41,7 +41,8 @@
|
|
41 |
31. removing scripts added by cleantalk
|
42 |
32. removing bj loading for amp
|
43 |
33. Google tag manager support added
|
44 |
-
|
|
|
45 |
*/
|
46 |
// Adding AMP-related things to the main theme
|
47 |
global $redux_builder_amp;
|
@@ -83,24 +84,21 @@
|
|
83 |
if( is_attachment() ) {
|
84 |
return;
|
85 |
}
|
86 |
-
if(
|
87 |
-
if( !$redux_builder_amp['amp-on-off-for-all-pages'] ) {
|
88 |
return;
|
89 |
-
}
|
90 |
-
}
|
91 |
-
if( is_archive() ) {
|
92 |
-
if( ! $redux_builder_amp['ampforwp-archive-support'] ) {
|
93 |
-
//dont do anything
|
94 |
-
return;
|
95 |
-
}
|
96 |
}
|
97 |
-
|
98 |
-
|
99 |
-
if( ! $redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
|
100 |
-
//dont do anything
|
101 |
-
return;
|
102 |
-
}
|
103 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
if ( is_home() || is_front_page() || is_archive() ){
|
106 |
global $wp;
|
@@ -116,7 +114,36 @@
|
|
116 |
if( $ampforwp_amp_post_on_off_meta === 'hide-amp' ) {
|
117 |
//dont Echo anything
|
118 |
} else {
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
}
|
121 |
} //end of ampforwp_home_archive_rel_canonical()
|
122 |
|
@@ -551,6 +578,7 @@
|
|
551 |
$content = preg_replace('/<like\s(.*?)>(.*)<\/like>/i', '', $content);
|
552 |
$content = preg_replace('/<g:plusone\s(.*?)>(.*)<\/g:plusone>/i', '', $content);
|
553 |
$content = preg_replace('/imageanchor="1"/i', '', $content);
|
|
|
554 |
|
555 |
// $content = preg_replace('/<img*/', '<amp-img', $content); // Fallback for plugins
|
556 |
return $content;
|
@@ -1123,3 +1151,48 @@ function amp_gtm_add_gtm_support( $analytics ) {
|
|
1123 |
return $analytics;
|
1124 |
}
|
1125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
31. removing scripts added by cleantalk
|
42 |
32. removing bj loading for amp
|
43 |
33. Google tag manager support added
|
44 |
+
34. social share boost compatibility Ticket #387
|
45 |
+
35. Disqus Comments Support
|
46 |
*/
|
47 |
// Adding AMP-related things to the main theme
|
48 |
global $redux_builder_amp;
|
84 |
if( is_attachment() ) {
|
85 |
return;
|
86 |
}
|
87 |
+
if( is_home() && !$redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
|
|
|
88 |
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
+
if( is_front_page() && ! $redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
|
91 |
+
return;
|
|
|
|
|
|
|
|
|
92 |
}
|
93 |
+
if ( is_archive() && !$redux_builder_amp['ampforwp-archive-support'] ) {
|
94 |
+
return;
|
95 |
+
}
|
96 |
+
if( is_page() && !$redux_builder_amp['amp-on-off-for-all-pages'] ) {
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
if( is_page() && !$redux_builder_amp['amp-on-off-for-all-pages'] ) {
|
100 |
+
return;
|
101 |
+
}
|
102 |
|
103 |
if ( is_home() || is_front_page() || is_archive() ){
|
104 |
global $wp;
|
114 |
if( $ampforwp_amp_post_on_off_meta === 'hide-amp' ) {
|
115 |
//dont Echo anything
|
116 |
} else {
|
117 |
+
$supported_types = array('post','page');
|
118 |
+
if ( $redux_builder_amp['ampforwp-custom-type'] ) {
|
119 |
+
foreach($redux_builder_amp['ampforwp-custom-type'] as $custom_post){
|
120 |
+
$supported_types[] = $custom_post;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
$type = get_post_type();
|
125 |
+
$supported_amp_post_types = in_array( $type , $supported_types );
|
126 |
+
|
127 |
+
if ( is_home() && $wp->query_vars['paged'] >= '2' ) {
|
128 |
+
$new_url = home_url('/');
|
129 |
+
$new_url = $new_url . AMP_QUERY_VAR . '/' . $wp->request ;
|
130 |
+
$amp_url = $new_url ;
|
131 |
+
}
|
132 |
+
if ( is_archive() && $wp->query_vars['paged'] >= '2' ) {
|
133 |
+
$new_url = home_url('/');
|
134 |
+
$category_path = $wp->request;
|
135 |
+
$explode_path = explode("/",$category_path);
|
136 |
+
$inserted = array(AMP_QUERY_VAR);
|
137 |
+
array_splice( $explode_path, -2, 0, $inserted );
|
138 |
+
$impode_url = implode('/', $explode_path);
|
139 |
+
|
140 |
+
$amp_url = $new_url . $impode_url ;
|
141 |
+
}
|
142 |
+
|
143 |
+
if( $supported_amp_post_types ) {
|
144 |
+
printf( '<link rel="amphtml" href="%s" />', esc_url( $amp_url ) );
|
145 |
+
}
|
146 |
+
|
147 |
}
|
148 |
} //end of ampforwp_home_archive_rel_canonical()
|
149 |
|
578 |
$content = preg_replace('/<like\s(.*?)>(.*)<\/like>/i', '', $content);
|
579 |
$content = preg_replace('/<g:plusone\s(.*?)>(.*)<\/g:plusone>/i', '', $content);
|
580 |
$content = preg_replace('/imageanchor="1"/i', '', $content);
|
581 |
+
$content = preg_replace('/<plusone\s(.*?)>(.*?)<\/plusone>/', '', $content);
|
582 |
|
583 |
// $content = preg_replace('/<img*/', '<amp-img', $content); // Fallback for plugins
|
584 |
return $content;
|
1151 |
return $analytics;
|
1152 |
}
|
1153 |
|
1154 |
+
//34. social share boost compatibility Ticket #387
|
1155 |
+
function social_sharing_removal_code() {
|
1156 |
+
remove_filter('the_content','ssb_in_content');
|
1157 |
+
}
|
1158 |
+
add_action('amp_init','social_sharing_removal_code', 9);
|
1159 |
+
|
1160 |
+
|
1161 |
+
//35. Disqus Comments Support
|
1162 |
+
// add_action('ampforwp_post_after_design_elements','ampforwp_add_disqus_support');
|
1163 |
+
function ampforwp_add_disqus_support() {
|
1164 |
+
|
1165 |
+
global $redux_builder_amp;
|
1166 |
+
if ( $redux_builder_amp['ampforwp-disqus-comments-support'] ) {
|
1167 |
+
|
1168 |
+
global $post; $post_slug=$post->post_name;
|
1169 |
+
|
1170 |
+
$disqus_script_host_url = "https://ampforwp.com/goto/". AMPFORWP_DISQUS_URL;
|
1171 |
+
|
1172 |
+
if( $redux_builder_amp['ampforwp-disqus-host-position'] == 0 ) {
|
1173 |
+
$disqus_script_host_url = esc_url( $redux_builder_amp['ampforwp-disqus-host-file'] );
|
1174 |
+
}
|
1175 |
+
|
1176 |
+
$disqus_url = $disqus_script_host_url.'?disqus_title='.$post_slug.'&url='.get_permalink().'&disqus_name='. esc_url( $redux_builder_amp['ampforwp-disqus-comments-name'] ) ."/embed.js" ;
|
1177 |
+
?>
|
1178 |
+
<section class="post-comments amp-wp-article-content amp-disqus-comments" id="comments">
|
1179 |
+
<amp-iframe
|
1180 |
+
height="350"
|
1181 |
+
sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"
|
1182 |
+
resizable
|
1183 |
+
frameborder="0"
|
1184 |
+
src="<?php echo $disqus_url ?>" >
|
1185 |
+
<div overflow tabindex="0" role="button" aria-label="Read more"> Disqus Comments Loading...</div>
|
1186 |
+
</amp-iframe>
|
1187 |
+
</section>
|
1188 |
+
<?php
|
1189 |
+
}
|
1190 |
+
}
|
1191 |
+
|
1192 |
+
// add_filter( 'amp_post_template_data', 'ampforwp_add_disqus_scripts' );
|
1193 |
+
function ampforwp_add_disqus_scripts( $data ) {
|
1194 |
+
if ( empty( $data['amp_component_scripts']['amp-iframe'] ) ) {
|
1195 |
+
$data['amp_component_scripts']['amp-iframe'] = 'https://cdn.ampproject.org/v0/amp-iframe-0.1.js';
|
1196 |
+
}
|
1197 |
+
return $data;
|
1198 |
+
}
|