Version Description
(18th February 2018) = * View more details on https://ampforwp.com/0-9-82-released-stability-update-82nd-update/ * Logo Resizing calculation by Pixels and resizing bug solved. * Update Notification in the Admin panel will only appear in the AMP options panel. So it will not annoy you anymore. * Glue underline is applying for some reason * Fatal error after 0.9.81 fixed * Facebook comments loading twice on swift * PHP Notice: Undefined variable: post_author_name * Pagebuilder fix in version 0.9.81 Compatibility with Yoast and other plugins #1749 * Home loop modifier option added. Allows you to exclude the categories from the loop or include the Custom Post type in the homepage loop. * amphtml Conflict with Instant Article for Facebook resolved * /amp folder in the theme is applying changes in plugin, which causing a bug, but its been fixed * Backward Compatibility for AMP Preview * SEO Section Improvements * Wrong comments count on AMP pages * AMP Allow selector in the The Content. You can add tabs and AMP components directly into the loop. * If we turn off the Homepage Support then Blog is turned off as well, solved. * Post Pagination have two options like Number of pages and Previous & Next. * Removed the dot from the one Signal Service worker URL if the subdomain isnt added (Causes Validation issues.) * Extra Space due to empty divs in Design 3 * Remove alt from a tag in the AMP version caused many validation issues.
Release Info
Developer | ahmedkaludi |
Plugin | AMP for WP – Accelerated Mobile Pages |
Version | 0.9.82 |
Comparing to | |
See all releases |
Code changes from version 0.9.81 to 0.9.82
- accelerated-moblie-pages.php +8 -5
- components/comments/comments.php +0 -6
- components/logo/logo.php +7 -3
- includes/options/admin-config.php +95 -20
- includes/options/extensions/amp_slider/amp_slider/field_amp_slider.js +7 -3
- includes/redirect.php +26 -25
- includes/thirdparty-compatibility.php +1 -1
- includes/vendor/amp/includes/class-amp-post-template.php +3 -5
- includes/vendor/vendor-changelog.txt +2 -1
- pagebuilder/amp-page-builder.php +13 -0
- pagebuilder/functions.php +2 -2
- pagebuilder/inc/adminAjaxContents.php +2 -2
- pagebuilder/inc/viewShowFrontData.php +18 -18
- pagebuilder/modules/contents-module.php +3 -2
- readme.txt +24 -1
- templates/design-manager/design-1/style.php +4 -1
- templates/design-manager/design-2/style.php +4 -1
- templates/design-manager/design-3/style.php +5 -2
- templates/features.php +167 -28
@@ -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/25
|
@@ -19,7 +19,7 @@ define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
|
|
19 |
define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
|
20 |
define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
|
21 |
define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
|
22 |
-
define('AMPFORWP_VERSION','0.9.
|
23 |
|
24 |
// any changes to AMP_QUERY_VAR should be refelected here
|
25 |
function ampforwp_generate_endpoint(){
|
@@ -321,7 +321,8 @@ if ( is_admin() ) {
|
|
321 |
if ( ! isset($plugin))
|
322 |
$plugin = plugin_basename(__FILE__);
|
323 |
if ( $plugin === $plugin_file ) {
|
324 |
-
$settings = array( 'settings' => '<a href="admin.php?page=amp_options&tab=8">' . __('Settings', 'accelerated-mobile-pages') . '</a> | <a href="https://ampforwp.com/
|
|
|
325 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
326 |
$actions = array_merge( $actions, $settings );
|
327 |
}
|
@@ -479,8 +480,10 @@ function amp_update_db_check() {
|
|
479 |
add_action( 'plugins_loaded', 'amp_update_db_check' );
|
480 |
|
481 |
function ampforwp_update_notice() {
|
|
|
|
|
482 |
$ampforwp_current_version = AMPFORWP_VERSION;
|
483 |
-
?>
|
484 |
<div class="notice-success notice is-dismissible amp-update-notice">
|
485 |
<div class="amp-update-notice-text-box">
|
486 |
<img src="data:image/png;base64,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" width="128" height="128" />
|
@@ -494,7 +497,7 @@ function ampforwp_update_notice() {
|
|
494 |
<a class="star_icon" href="https://wordpress.org/support/view/plugin-reviews/accelerated-mobile-pages?rate=5#new-post" target="_blank"> Appreciate it? <br> <span title="Give Us 5 Star">Leave a Review →</span></a>
|
495 |
</div>
|
496 |
</div>
|
497 |
-
<?php
|
498 |
}
|
499 |
if ( ! defined('AMP_FRAMEWORK_COMOPNENT_DIR_PATH') ) {
|
500 |
define('AMP_FRAMEWORK_COMOPNENT_DIR_PATH', plugin_dir_path( __FILE__ )."/components");
|
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.82
|
7 |
Author: Ahmed Kaludi, Mohammed Kaludi
|
8 |
Author URI: https://ampforwp.com/
|
9 |
Donate link: https://www.paypal.me/Kaludi/25
|
19 |
define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
|
20 |
define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
|
21 |
define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
|
22 |
+
define('AMPFORWP_VERSION','0.9.82');
|
23 |
|
24 |
// any changes to AMP_QUERY_VAR should be refelected here
|
25 |
function ampforwp_generate_endpoint(){
|
321 |
if ( ! isset($plugin))
|
322 |
$plugin = plugin_basename(__FILE__);
|
323 |
if ( $plugin === $plugin_file ) {
|
324 |
+
$settings = array( 'settings' => '<a href="admin.php?page=amp_options&tab=8">' . __('Settings', 'accelerated-mobile-pages') . '</a> | <a href="https://ampforwp.com/extensions/#utm_source=plugin-panel&utm_medium=plugin-extension&utm_campaign=features">' . __('Premium Features', 'accelerated-mobile-pages') . '</a> | <a href="https://ampforwp.com/membership/#utm_source=plugin-panel&utm_medium=plugin-extension&utm_campaign=pro">' . __('Pro', 'accelerated-mobile-pages') . '</a>' );
|
325 |
+
|
326 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
327 |
$actions = array_merge( $actions, $settings );
|
328 |
}
|
480 |
add_action( 'plugins_loaded', 'amp_update_db_check' );
|
481 |
|
482 |
function ampforwp_update_notice() {
|
483 |
+
$screen = '';
|
484 |
+
$screen = get_current_screen();
|
485 |
$ampforwp_current_version = AMPFORWP_VERSION;
|
486 |
+
if ( 'toplevel_page_amp_options' == $screen->base ) { ?>
|
487 |
<div class="notice-success notice is-dismissible amp-update-notice">
|
488 |
<div class="amp-update-notice-text-box">
|
489 |
<img src="data:image/png;base64,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" width="128" height="128" />
|
497 |
<a class="star_icon" href="https://wordpress.org/support/view/plugin-reviews/accelerated-mobile-pages?rate=5#new-post" target="_blank"> Appreciate it? <br> <span title="Give Us 5 Star">Leave a Review →</span></a>
|
498 |
</div>
|
499 |
</div>
|
500 |
+
<?php }
|
501 |
}
|
502 |
if ( ! defined('AMP_FRAMEWORK_COMOPNENT_DIR_PATH') ) {
|
503 |
define('AMP_FRAMEWORK_COMOPNENT_DIR_PATH', plugin_dir_path( __FILE__ )."/components");
|
@@ -108,9 +108,6 @@ if ( true == $redux_builder_amp['wordpress-comments-support'] ) { ?>
|
|
108 |
function ampforwp_framework_get_facebook_comments(){
|
109 |
global $redux_builder_amp;
|
110 |
$facebook_comments_markup = '';
|
111 |
-
if ( !comments_open() ){
|
112 |
-
return;
|
113 |
-
}
|
114 |
if ( $redux_builder_amp['ampforwp-facebook-comments-support'] ) {
|
115 |
$facebook_comments_markup = '<section class="amp-facebook-comments">';
|
116 |
$facebook_comments_markup .= '<amp-facebook-comments width=486 height=357
|
@@ -127,9 +124,6 @@ global $redux_builder_amp;
|
|
127 |
//Disqus Comments
|
128 |
function ampforwp_framework_get_disqus_comments(){
|
129 |
global $redux_builder_amp;
|
130 |
-
if ( !comments_open() ){
|
131 |
-
return;
|
132 |
-
}//931
|
133 |
if( $redux_builder_amp['ampforwp-disqus-comments-name'] !== '' ) {
|
134 |
global $post; $post_slug=$post->post_name;
|
135 |
|
108 |
function ampforwp_framework_get_facebook_comments(){
|
109 |
global $redux_builder_amp;
|
110 |
$facebook_comments_markup = '';
|
|
|
|
|
|
|
111 |
if ( $redux_builder_amp['ampforwp-facebook-comments-support'] ) {
|
112 |
$facebook_comments_markup = '<section class="amp-facebook-comments">';
|
113 |
$facebook_comments_markup .= '<amp-facebook-comments width=486 height=357
|
124 |
//Disqus Comments
|
125 |
function ampforwp_framework_get_disqus_comments(){
|
126 |
global $redux_builder_amp;
|
|
|
|
|
|
|
127 |
if( $redux_builder_amp['ampforwp-disqus-comments-name'] !== '' ) {
|
128 |
global $post; $post_slug=$post->post_name;
|
129 |
|
@@ -45,10 +45,14 @@ if( !function_exists( 'amp_framework_logo_styles' ) ){
|
|
45 |
function amp_framework_logo_styles(){
|
46 |
global $redux_builder_amp;
|
47 |
$max_width = '190px';
|
|
|
48 |
if ( true == $redux_builder_amp['ampforwp-custom-logo-dimensions-options'] && isset($redux_builder_amp['ampforwp-custom-logo-dimensions-options']) && 'flexible' == $redux_builder_amp['ampforwp-custom-logo-dimensions-options'] ) {
|
49 |
-
|
|
|
|
|
50 |
}
|
51 |
-
|
52 |
-
|
|
|
53 |
<?php }
|
54 |
}
|
45 |
function amp_framework_logo_styles(){
|
46 |
global $redux_builder_amp;
|
47 |
$max_width = '190px';
|
48 |
+
$width = ampforwp_default_logo('width');
|
49 |
if ( true == $redux_builder_amp['ampforwp-custom-logo-dimensions-options'] && isset($redux_builder_amp['ampforwp-custom-logo-dimensions-options']) && 'flexible' == $redux_builder_amp['ampforwp-custom-logo-dimensions-options'] ) {
|
50 |
+
$max_width = $redux_builder_amp['ampforwp-custom-logo-dimensions-slider'];
|
51 |
+
$logoWidth = ampforwp_default_logo('width');
|
52 |
+
$max_width = ceil(($width*$max_width)/100)."px";
|
53 |
}
|
54 |
+
$width .= 'px';
|
55 |
+
?>
|
56 |
+
.amp-logo amp-img{width:<?php echo $max_width; ?>}
|
57 |
<?php }
|
58 |
}
|
@@ -1046,53 +1046,86 @@ Redux::setArgs( "redux_builder_amp", $args );
|
|
1046 |
),
|
1047 |
) );
|
1048 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1049 |
// SEO SECTION
|
1050 |
Redux::setSection( $opt_name, array(
|
1051 |
'title' => __( 'SEO', 'accelerated-mobile-pages' ),
|
1052 |
'id' => 'amp-seo',
|
1053 |
'subsection' => true,
|
1054 |
'fields' => array(
|
1055 |
-
|
1056 |
-
|
|
|
|
|
|
|
|
|
|
|
1057 |
'id' => 'ampforwp-seo-meta-description',
|
1058 |
'type' => 'switch',
|
1059 |
'title' => __('Meta Description', 'accelerated-mobile-pages'),
|
1060 |
'subtitle' => __('The meta tag that displays in head', 'accelerated-mobile-pages'),
|
1061 |
'default' => 0
|
1062 |
-
|
1063 |
|
1064 |
-
|
1065 |
'id' => 'ampforwp-seo-custom-additional-meta',
|
1066 |
'type' => 'textarea',
|
1067 |
'title' => __('Additional tags for Head section AMP page', 'accelerated-mobile-pages'),
|
1068 |
'subtitle' => __('Adds additional Meta to the head section', 'accelerated-mobile-pages', 'accelerated-mobile-pages'),
|
1069 |
'desc' => __('Only link and meta tags allowed', 'accelerated-mobile-pages'),
|
1070 |
'placeholder' => __('<!-- Paste your Additional HTML , that goes between <head> </head> tags -->','accelerated-mobile-pages')
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
array(
|
1075 |
-
'id' => 'ampforwp-yoast-seo-sub-section',
|
1076 |
'type' => 'section',
|
1077 |
-
'title' => __('
|
1078 |
-
'indent' => true
|
1079 |
),
|
1080 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1081 |
array(
|
1082 |
'id' => 'ampforwp-seo-yoast-meta',
|
1083 |
'type' => 'switch',
|
1084 |
'subtitle' => __('Adds Social and Open Graph Meta Tags from Yoast', 'accelerated-mobile-pages'),
|
1085 |
'title' => __( 'Meta Tags from Yoast', 'accelerated-mobile-pages' ),
|
1086 |
-
'default' => '1'
|
|
|
1087 |
),
|
1088 |
array(
|
1089 |
'id' => 'ampforwp-seo-yoast-description',
|
1090 |
'type' => 'switch',
|
1091 |
'subtitle' => __('Adds Yoast Custom description to ld+json for AMP page', 'accelerated-mobile-pages'),
|
1092 |
'title' => __( 'Yoast Description in ld+json', 'accelerated-mobile-pages' ),
|
1093 |
-
'default' => 0
|
|
|
1094 |
),
|
1095 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1096 |
array(
|
1097 |
'id' => 'ampforwp-seo-index-noindex-sub-section',
|
1098 |
'type' => 'section',
|
@@ -1111,7 +1144,7 @@ Redux::setArgs( "redux_builder_amp", $args );
|
|
1111 |
array(
|
1112 |
'id' => 'ampforwp-robots-archive-author-pages',
|
1113 |
'type' => 'switch',
|
1114 |
-
'title' => __('Author
|
1115 |
'default' => 1,
|
1116 |
'on' => 'index',
|
1117 |
'off' => 'noindex'
|
@@ -1120,7 +1153,7 @@ Redux::setArgs( "redux_builder_amp", $args );
|
|
1120 |
array(
|
1121 |
'id' => 'ampforwp-robots-archive-date-pages',
|
1122 |
'type' => 'switch',
|
1123 |
-
'title' => __('Date
|
1124 |
'default' => 1,
|
1125 |
'on' => 'index',
|
1126 |
'off' => 'noindex'
|
@@ -1150,7 +1183,7 @@ Redux::setArgs( "redux_builder_amp", $args );
|
|
1150 |
|
1151 |
);
|
1152 |
|
1153 |
-
//
|
1154 |
Redux::setSection( $opt_name, array(
|
1155 |
'title' => __( 'Performance', 'accelerated-mobile-pages' ),
|
1156 |
'id' => 'amp-performance',
|
@@ -3439,14 +3472,24 @@ Redux::setSection( $opt_name, array(
|
|
3439 |
}
|
3440 |
endif;
|
3441 |
//End of code for fetching ctegories to show as a list in redux settings
|
|
|
|
|
|
|
|
|
3442 |
|
3443 |
-
|
3444 |
Redux::setSection( $opt_name, array(
|
3445 |
'title' => __( 'HomePage', 'accelerated-mobile-pages' ),
|
3446 |
'id' => 'amp-theme-homepage-settings',
|
3447 |
'subsection' => true,
|
3448 |
'fields' => array(
|
3449 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3450 |
'id' => 'amp-design-3-featured-slider',
|
3451 |
'type' => 'switch',
|
3452 |
'title' => __( 'Featured Slider', 'accelerated-mobile-pages' ),
|
@@ -3618,6 +3661,26 @@ Redux::setSection( $opt_name, array(
|
|
3618 |
array('ampforwp-homepage-posts-image-modify-size','=',1)
|
3619 |
)
|
3620 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3621 |
|
3622 |
)
|
3623 |
));
|
@@ -3726,6 +3789,18 @@ Redux::setSection( $opt_name, array(
|
|
3726 |
'type' => 'switch',
|
3727 |
'title' => __( 'Post Pagination', 'accelerated-mobile-pages' ),
|
3728 |
'default' => 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3729 |
),
|
3730 |
// Related Post
|
3731 |
array(
|
1046 |
),
|
1047 |
) );
|
1048 |
|
1049 |
+
if ( ! function_exists('ampforwp_seo_default') ) {
|
1050 |
+
function ampforwp_seo_default() {
|
1051 |
+
$default = '';
|
1052 |
+
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
1053 |
+
if ( is_plugin_active('wordpress-seo/wp-seo.php') ) {
|
1054 |
+
$default = 1;
|
1055 |
+
}
|
1056 |
+
elseif ( is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php') ) {
|
1057 |
+
$default = 2;
|
1058 |
+
}
|
1059 |
+
return $default;
|
1060 |
+
}
|
1061 |
+
}
|
1062 |
// SEO SECTION
|
1063 |
Redux::setSection( $opt_name, array(
|
1064 |
'title' => __( 'SEO', 'accelerated-mobile-pages' ),
|
1065 |
'id' => 'amp-seo',
|
1066 |
'subsection' => true,
|
1067 |
'fields' => array(
|
1068 |
+
array(
|
1069 |
+
'id' => 'ampforwp-seo-general-section',
|
1070 |
+
'type' => 'section',
|
1071 |
+
'title' => __('General', 'accelerated-mobile-pages'),
|
1072 |
+
'indent' => true,
|
1073 |
+
),
|
1074 |
+
array(
|
1075 |
'id' => 'ampforwp-seo-meta-description',
|
1076 |
'type' => 'switch',
|
1077 |
'title' => __('Meta Description', 'accelerated-mobile-pages'),
|
1078 |
'subtitle' => __('The meta tag that displays in head', 'accelerated-mobile-pages'),
|
1079 |
'default' => 0
|
1080 |
+
),
|
1081 |
|
1082 |
+
array(
|
1083 |
'id' => 'ampforwp-seo-custom-additional-meta',
|
1084 |
'type' => 'textarea',
|
1085 |
'title' => __('Additional tags for Head section AMP page', 'accelerated-mobile-pages'),
|
1086 |
'subtitle' => __('Adds additional Meta to the head section', 'accelerated-mobile-pages', 'accelerated-mobile-pages'),
|
1087 |
'desc' => __('Only link and meta tags allowed', 'accelerated-mobile-pages'),
|
1088 |
'placeholder' => __('<!-- Paste your Additional HTML , that goes between <head> </head> tags -->','accelerated-mobile-pages')
|
1089 |
+
),
|
1090 |
+
array(
|
1091 |
+
'id' => 'ampforwp-seo-plugins-section',
|
|
|
|
|
1092 |
'type' => 'section',
|
1093 |
+
'title' => __('SEO Plugin Integration', 'accelerated-mobile-pages'),
|
1094 |
+
'indent' => true,
|
1095 |
),
|
1096 |
+
array(
|
1097 |
+
'id' => 'ampforwp-seo-selection',
|
1098 |
+
'type' => 'select',
|
1099 |
+
'title' => __('Select SEO Plugin', 'accelerated-mobile-pages'),
|
1100 |
+
'options' => array(
|
1101 |
+
'1' => 'Yoast',
|
1102 |
+
'2' => 'All in One SEO'
|
1103 |
+
),
|
1104 |
+
'default' => ampforwp_seo_default(),
|
1105 |
+
),
|
1106 |
array(
|
1107 |
'id' => 'ampforwp-seo-yoast-meta',
|
1108 |
'type' => 'switch',
|
1109 |
'subtitle' => __('Adds Social and Open Graph Meta Tags from Yoast', 'accelerated-mobile-pages'),
|
1110 |
'title' => __( 'Meta Tags from Yoast', 'accelerated-mobile-pages' ),
|
1111 |
+
'default' => '1',
|
1112 |
+
'required' => array('ampforwp-seo-selection', '=' , '1'),
|
1113 |
),
|
1114 |
array(
|
1115 |
'id' => 'ampforwp-seo-yoast-description',
|
1116 |
'type' => 'switch',
|
1117 |
'subtitle' => __('Adds Yoast Custom description to ld+json for AMP page', 'accelerated-mobile-pages'),
|
1118 |
'title' => __( 'Yoast Description in ld+json', 'accelerated-mobile-pages' ),
|
1119 |
+
'default' => 0,
|
1120 |
+
'required' => array('ampforwp-seo-selection', '=' , '1'),
|
1121 |
),
|
1122 |
+
array(
|
1123 |
+
'id' => 'ampforwp-seo-aioseo',
|
1124 |
+
'type' => 'info',
|
1125 |
+
'style' => 'success',
|
1126 |
+
'desc' => __("All in One SEO works out of the Box with our plugin. It deosn't requires any extra config.", 'accelerated-mobile-pages'),
|
1127 |
+
'required' => array('ampforwp-seo-selection', '=', '2')
|
1128 |
+
),
|
1129 |
array(
|
1130 |
'id' => 'ampforwp-seo-index-noindex-sub-section',
|
1131 |
'type' => 'section',
|
1144 |
array(
|
1145 |
'id' => 'ampforwp-robots-archive-author-pages',
|
1146 |
'type' => 'switch',
|
1147 |
+
'title' => __('Author Archives', 'accelerated-mobile-pages'),
|
1148 |
'default' => 1,
|
1149 |
'on' => 'index',
|
1150 |
'off' => 'noindex'
|
1153 |
array(
|
1154 |
'id' => 'ampforwp-robots-archive-date-pages',
|
1155 |
'type' => 'switch',
|
1156 |
+
'title' => __('Date Archives', 'accelerated-mobile-pages'),
|
1157 |
'default' => 1,
|
1158 |
'on' => 'index',
|
1159 |
'off' => 'noindex'
|
1183 |
|
1184 |
);
|
1185 |
|
1186 |
+
// Performance SECTION
|
1187 |
Redux::setSection( $opt_name, array(
|
1188 |
'title' => __( 'Performance', 'accelerated-mobile-pages' ),
|
1189 |
'id' => 'amp-performance',
|
3472 |
}
|
3473 |
endif;
|
3474 |
//End of code for fetching ctegories to show as a list in redux settings
|
3475 |
+
$ampforwp_home_loop = array();
|
3476 |
+
$ampforwp_home_loop = get_option('ampforwp_custom_post_types');
|
3477 |
+
$ampforwp_home_loop['post'] = 'Posts';
|
3478 |
+
unset($ampforwp_home_loop['page']);
|
3479 |
|
3480 |
+
// HomePage Section
|
3481 |
Redux::setSection( $opt_name, array(
|
3482 |
'title' => __( 'HomePage', 'accelerated-mobile-pages' ),
|
3483 |
'id' => 'amp-theme-homepage-settings',
|
3484 |
'subsection' => true,
|
3485 |
'fields' => array(
|
3486 |
+
array(
|
3487 |
+
'id' => 'ampforwp-homepage-section-general',
|
3488 |
+
'type' => 'section',
|
3489 |
+
'title' => __('General', 'accelerated-mobile-pages'),
|
3490 |
+
'indent' => true,
|
3491 |
+
),
|
3492 |
+
array(
|
3493 |
'id' => 'amp-design-3-featured-slider',
|
3494 |
'type' => 'switch',
|
3495 |
'title' => __( 'Featured Slider', 'accelerated-mobile-pages' ),
|
3661 |
array('ampforwp-homepage-posts-image-modify-size','=',1)
|
3662 |
)
|
3663 |
),
|
3664 |
+
array(
|
3665 |
+
'id' => 'ampforwp-homepage-section-loop',
|
3666 |
+
'type' => 'section',
|
3667 |
+
'title' => __('Loop Display Controls', 'accelerated-mobile-pages'),
|
3668 |
+
'indent' => true,
|
3669 |
+
),
|
3670 |
+
array(
|
3671 |
+
'id' => 'ampforwp-homepage-loop-type',
|
3672 |
+
'type' => 'select',
|
3673 |
+
'title' => __( 'Post Type in Loop', 'accelerated-mobile-pages' ),
|
3674 |
+
'options' => $ampforwp_home_loop,
|
3675 |
+
'default' => 'post',
|
3676 |
+
),
|
3677 |
+
array(
|
3678 |
+
'id' => 'ampforwp-homepage-loop-cats',
|
3679 |
+
'type' => 'select',
|
3680 |
+
'title' => __( 'Exclude Categories', 'accelerated-mobile-pages' ),
|
3681 |
+
'data' => 'categories',
|
3682 |
+
'multi' => true
|
3683 |
+
),
|
3684 |
|
3685 |
)
|
3686 |
));
|
3789 |
'type' => 'switch',
|
3790 |
'title' => __( 'Post Pagination', 'accelerated-mobile-pages' ),
|
3791 |
'default' => 1,
|
3792 |
+
'subtitle' => __('Enable the feature to add Pagination in single', 'accelerated-mobile-pages'),
|
3793 |
+
),
|
3794 |
+
array(
|
3795 |
+
'id' => 'ampforwp-pagination-select',
|
3796 |
+
'type' => 'select',
|
3797 |
+
'title' => __('Post Pagination Type', 'accelerated-mobile-pages'),
|
3798 |
+
'options' => array(
|
3799 |
+
'1' => 'Numbering',
|
3800 |
+
'2' => 'Next-Previous',
|
3801 |
+
),
|
3802 |
+
'default' => '1',
|
3803 |
+
'required' => array('amp-pagination' , '=' , '1'),
|
3804 |
),
|
3805 |
// Related Post
|
3806 |
array(
|
@@ -304,7 +304,9 @@
|
|
304 |
img.src = imageUrl;
|
305 |
img.onload = function(){
|
306 |
if(jQuery('#redux_builder_amp-ampforwp-custom-logo-dimensions-slider').find('.logo_preview').find('img').length==0){
|
307 |
-
|
|
|
|
|
308 |
}
|
309 |
}
|
310 |
}
|
@@ -315,9 +317,11 @@
|
|
315 |
img.onload = function(){
|
316 |
|
317 |
if(previousImageUrl==imageUrl){
|
318 |
-
|
|
|
319 |
}else{
|
320 |
-
|
|
|
321 |
}
|
322 |
|
323 |
|
304 |
img.src = imageUrl;
|
305 |
img.onload = function(){
|
306 |
if(jQuery('#redux_builder_amp-ampforwp-custom-logo-dimensions-slider').find('.logo_preview').find('img').length==0){
|
307 |
+
var widthPx = (dimension*this.width)/100;
|
308 |
+
jQuery('#redux_builder_amp-ampforwp-custom-logo-dimensions-slider').append("<div class='logo_preview'><img src='"+imageUrl+"' style='width:"+widthPx+"px !important;'></div>");
|
309 |
+
|
310 |
}
|
311 |
}
|
312 |
}
|
317 |
img.onload = function(){
|
318 |
|
319 |
if(previousImageUrl==imageUrl){
|
320 |
+
var widthPx = (dimension*this.width)/100;
|
321 |
+
jQuery('#redux_builder_amp-ampforwp-custom-logo-dimensions-slider').find('.logo_preview').find('img').attr('style','width:'+widthPx+'px !important;');
|
322 |
}else{
|
323 |
+
var widthPx = (dimension*this.width)/100;
|
324 |
+
jQuery('#redux_builder_amp-ampforwp-custom-logo-dimensions-slider').find('.logo_preview').find('img').attr('src',imageUrl).attr('style','width:'+widthPx+'px !important;');
|
325 |
}
|
326 |
|
327 |
|
@@ -5,17 +5,16 @@ function ampforwp_check_amp_page_status() {
|
|
5 |
$hide_cats_amp = '';
|
6 |
$hide_cats_amp = is_category_amp_disabled();
|
7 |
if ( ampforwp_is_amp_endpoint() ) {
|
8 |
-
if ( (is_archive() && $redux_builder_amp['ampforwp-archive-support']
|
9 |
global $wp;
|
10 |
-
$redirection_location
|
11 |
|
12 |
-
$redirection_location
|
13 |
|
14 |
-
$redirection_location
|
15 |
wp_safe_redirect( $redirection_location );
|
16 |
exit;
|
17 |
}
|
18 |
-
|
19 |
}
|
20 |
}
|
21 |
add_action( 'template_redirect', 'ampforwp_check_amp_page_status', 10 );
|
@@ -36,40 +35,40 @@ function ampforwp_page_template_redirect() {
|
|
36 |
$url_to_redirect = ampforwp_amphtml_generator();
|
37 |
|
38 |
|
39 |
-
if( isset($redux_builder_amp['amp-mobile-redirection']) && $redux_builder_amp['amp-mobile-redirection']){
|
40 |
|
41 |
// Return if the set value is not met and do not start redirection
|
42 |
-
if(
|
43 |
return;
|
44 |
}
|
45 |
-
if(
|
46 |
return;
|
47 |
}
|
48 |
-
if( is_archive() && $redux_builder_amp['ampforwp-archive-support']
|
49 |
return;
|
50 |
}
|
51 |
if ( is_feed() ) {
|
52 |
return;
|
53 |
}
|
54 |
// #1192 Password Protected posts exclusion
|
55 |
-
if( post_password_required( $post )){
|
56 |
return;
|
57 |
}
|
58 |
|
59 |
// Return if some categories are selected as Hide #999
|
60 |
-
if(is_archive() && $redux_builder_amp['ampforwp-archive-support']){
|
61 |
$selected_cats = array();
|
62 |
$categories = get_the_category();
|
63 |
$category_id = $categories[0]->cat_ID;
|
64 |
-
$get_categories_from_checkbox =
|
65 |
// Check if $get_categories_from_checkbox has some cats then only show
|
66 |
if ( $get_categories_from_checkbox ) {
|
67 |
$get_selected_cats = array_filter($get_categories_from_checkbox);
|
68 |
-
foreach ($get_selected_cats as $key => $value) {
|
69 |
$selected_cats[] = $key;
|
70 |
}
|
71 |
-
if($selected_cats && $category_id){
|
72 |
-
if(in_array($category_id, $selected_cats)){
|
73 |
return;
|
74 |
}
|
75 |
}
|
@@ -81,11 +80,14 @@ function ampforwp_page_template_redirect() {
|
|
81 |
return;
|
82 |
}
|
83 |
|
84 |
-
if( is_page() && $redux_builder_amp['amp-on-off-for-all-pages']
|
85 |
return;
|
86 |
}
|
87 |
|
88 |
-
if(
|
|
|
|
|
|
|
89 |
return;
|
90 |
}
|
91 |
|
@@ -93,14 +95,14 @@ function ampforwp_page_template_redirect() {
|
|
93 |
session_start();
|
94 |
}
|
95 |
|
96 |
-
if( isset( $_SESSION['ampforwp_mobile'] ) && $_SESSION['ampforwp_amp_mode']
|
97 |
return;
|
98 |
}
|
99 |
|
100 |
-
if( wp_is_mobile() && $_SESSION['ampforwp_amp_mode']
|
101 |
// non mobile session variable creation
|
102 |
session_start();
|
103 |
-
$_SESSION['ampforwp_mobile']='exit';
|
104 |
if ( ampforwp_is_amp_endpoint() ) {
|
105 |
session_destroy();
|
106 |
}
|
@@ -109,11 +111,11 @@ function ampforwp_page_template_redirect() {
|
|
109 |
// Check if we are on Mobile phones then start redirection process
|
110 |
if ( wp_is_mobile() ) {
|
111 |
|
112 |
-
if( !isset($_SESSION['ampforwp_amp_mode']) || !isset($_GET['nonamp']) ) {
|
113 |
|
114 |
-
$_SESSION['ampforwp_amp_mode']='mobile-on';
|
115 |
|
116 |
-
if ( $url_to_redirect
|
117 |
wp_redirect( $url_to_redirect , 301 );
|
118 |
exit();
|
119 |
}
|
@@ -122,7 +124,6 @@ function ampforwp_page_template_redirect() {
|
|
122 |
return;
|
123 |
}
|
124 |
}
|
125 |
-
|
126 |
}
|
127 |
}
|
128 |
add_action( 'template_redirect', 'ampforwp_page_template_redirect', 30 );
|
@@ -132,7 +133,7 @@ add_action( 'template_redirect', 'ampforwp_page_template_redirect_archive', 10 )
|
|
132 |
function ampforwp_page_template_redirect_archive() {
|
133 |
|
134 |
if ( is_404() ) {
|
135 |
-
if( ampforwp_is_amp_endpoint() ) {
|
136 |
global $wp;
|
137 |
$ampforwp_404_url = add_query_arg( '', '', home_url( $wp->request ) );
|
138 |
$ampforwp_404_url = trailingslashit($ampforwp_404_url );
|
5 |
$hide_cats_amp = '';
|
6 |
$hide_cats_amp = is_category_amp_disabled();
|
7 |
if ( ampforwp_is_amp_endpoint() ) {
|
8 |
+
if ( (is_archive() && 0 == $redux_builder_amp['ampforwp-archive-support']) || true == $hide_cats_amp || ((ampforwp_is_home() || ampforwp_is_front_page()) && 0 == $redux_builder_amp['ampforwp-homepage-on-off-support']) ) {
|
9 |
global $wp;
|
10 |
+
$redirection_location = add_query_arg( '', '', home_url( $wp->request ) );
|
11 |
|
12 |
+
$redirection_location = trailingslashit($redirection_location );
|
13 |
|
14 |
+
$redirection_location = dirname($redirection_location);
|
15 |
wp_safe_redirect( $redirection_location );
|
16 |
exit;
|
17 |
}
|
|
|
18 |
}
|
19 |
}
|
20 |
add_action( 'template_redirect', 'ampforwp_check_amp_page_status', 10 );
|
35 |
$url_to_redirect = ampforwp_amphtml_generator();
|
36 |
|
37 |
|
38 |
+
if ( isset($redux_builder_amp['amp-mobile-redirection']) && $redux_builder_amp['amp-mobile-redirection'] ) {
|
39 |
|
40 |
// Return if the set value is not met and do not start redirection
|
41 |
+
if ( 'disable' == ampforwp_meta_redirection_status() ) {
|
42 |
return;
|
43 |
}
|
44 |
+
if ( false == $supported_amp_post_types ) {
|
45 |
return;
|
46 |
}
|
47 |
+
if ( is_archive() && 0 == $redux_builder_amp['ampforwp-archive-support'] ) {
|
48 |
return;
|
49 |
}
|
50 |
if ( is_feed() ) {
|
51 |
return;
|
52 |
}
|
53 |
// #1192 Password Protected posts exclusion
|
54 |
+
if ( post_password_required( $post ) ) {
|
55 |
return;
|
56 |
}
|
57 |
|
58 |
// Return if some categories are selected as Hide #999
|
59 |
+
if ( is_archive() && $redux_builder_amp['ampforwp-archive-support'] ) {
|
60 |
$selected_cats = array();
|
61 |
$categories = get_the_category();
|
62 |
$category_id = $categories[0]->cat_ID;
|
63 |
+
$get_categories_from_checkbox = $redux_builder_amp['hide-amp-categories'];
|
64 |
// Check if $get_categories_from_checkbox has some cats then only show
|
65 |
if ( $get_categories_from_checkbox ) {
|
66 |
$get_selected_cats = array_filter($get_categories_from_checkbox);
|
67 |
+
foreach ( $get_selected_cats as $key => $value ) {
|
68 |
$selected_cats[] = $key;
|
69 |
}
|
70 |
+
if ( $selected_cats && $category_id ) {
|
71 |
+
if ( in_array($category_id, $selected_cats) ) {
|
72 |
return;
|
73 |
}
|
74 |
}
|
80 |
return;
|
81 |
}
|
82 |
|
83 |
+
if ( is_page() && 0 == $redux_builder_amp['amp-on-off-for-all-pages'] ) {
|
84 |
return;
|
85 |
}
|
86 |
|
87 |
+
if ( is_home() && is_front_page() && 0 == $redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
if ( is_front_page() && 0 == $redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
|
91 |
return;
|
92 |
}
|
93 |
|
95 |
session_start();
|
96 |
}
|
97 |
|
98 |
+
if ( isset( $_SESSION['ampforwp_mobile'] ) && 'mobile-on' == $_SESSION['ampforwp_amp_mode'] && 'exit' == $_SESSION['ampforwp_mobile'] ) {
|
99 |
return;
|
100 |
}
|
101 |
|
102 |
+
if ( wp_is_mobile() && 'mobile-on' == $_SESSION['ampforwp_amp_mode'] && 1 == $_GET['nonamp'] ) {
|
103 |
// non mobile session variable creation
|
104 |
session_start();
|
105 |
+
$_SESSION['ampforwp_mobile'] = 'exit';
|
106 |
if ( ampforwp_is_amp_endpoint() ) {
|
107 |
session_destroy();
|
108 |
}
|
111 |
// Check if we are on Mobile phones then start redirection process
|
112 |
if ( wp_is_mobile() ) {
|
113 |
|
114 |
+
if ( ! isset($_SESSION['ampforwp_amp_mode']) || ! isset($_GET['nonamp']) ) {
|
115 |
|
116 |
+
$_SESSION['ampforwp_amp_mode'] = 'mobile-on';
|
117 |
|
118 |
+
if ( $url_to_redirect ) {
|
119 |
wp_redirect( $url_to_redirect , 301 );
|
120 |
exit();
|
121 |
}
|
124 |
return;
|
125 |
}
|
126 |
}
|
|
|
127 |
}
|
128 |
}
|
129 |
add_action( 'template_redirect', 'ampforwp_page_template_redirect', 30 );
|
133 |
function ampforwp_page_template_redirect_archive() {
|
134 |
|
135 |
if ( is_404() ) {
|
136 |
+
if ( ampforwp_is_amp_endpoint() ) {
|
137 |
global $wp;
|
138 |
$ampforwp_404_url = add_query_arg( '', '', home_url( $wp->request ) );
|
139 |
$ampforwp_404_url = trailingslashit($ampforwp_404_url );
|
@@ -80,7 +80,7 @@ if(!function_exists('ampforwp_amp_nonamp_convert')){
|
|
80 |
add_filter( 'amp_post_template_file', 'ampforwp_child_designing_custom_template', 20, 3 );
|
81 |
add_filter( 'amp_post_template_file', 'ampforwp_child_custom_footer_file', 20, 3 );
|
82 |
function ampforwp_theme_template_directry(){
|
83 |
-
return get_template_directory() . '/
|
84 |
}
|
85 |
// Custom Header
|
86 |
function ampforwp_child_custom_header_file( $file, $type, $post ) {
|
80 |
add_filter( 'amp_post_template_file', 'ampforwp_child_designing_custom_template', 20, 3 );
|
81 |
add_filter( 'amp_post_template_file', 'ampforwp_child_custom_footer_file', 20, 3 );
|
82 |
function ampforwp_theme_template_directry(){
|
83 |
+
return get_template_directory() . '/ampforwp/';
|
84 |
}
|
85 |
// Custom Header
|
86 |
function ampforwp_child_custom_header_file( $file, $type, $post ) {
|
@@ -159,6 +159,8 @@ class AMP_Post_Template {
|
|
159 |
}
|
160 |
|
161 |
private function build_post_data() {
|
|
|
|
|
162 |
$post_title = get_the_title( $this->ID );
|
163 |
$post_publish_timestamp = get_the_date( 'U', $this->ID );
|
164 |
$post_publish_timestamp = intval( $post_publish_timestamp );
|
@@ -169,10 +171,6 @@ class AMP_Post_Template {
|
|
169 |
$post_author_name = $post_author->display_name;
|
170 |
}
|
171 |
}
|
172 |
-
else {
|
173 |
-
$post_author = '';
|
174 |
-
$post_author_name = '';
|
175 |
-
}
|
176 |
$this->add_data( array(
|
177 |
'post' => $this->post,
|
178 |
'post_id' => $this->ID,
|
@@ -437,7 +435,7 @@ class AMP_Post_Template {
|
|
437 |
|
438 |
|
439 |
private function locate_template( $file ) {
|
440 |
-
$search_file = sprintf( '
|
441 |
return locate_template( array( $search_file ), false );
|
442 |
}
|
443 |
|
159 |
}
|
160 |
|
161 |
private function build_post_data() {
|
162 |
+
$post_author = '';
|
163 |
+
$post_author_name = '';
|
164 |
$post_title = get_the_title( $this->ID );
|
165 |
$post_publish_timestamp = get_the_date( 'U', $this->ID );
|
166 |
$post_publish_timestamp = intval( $post_publish_timestamp );
|
171 |
$post_author_name = $post_author->display_name;
|
172 |
}
|
173 |
}
|
|
|
|
|
|
|
|
|
174 |
$this->add_data( array(
|
175 |
'post' => $this->post,
|
176 |
'post_id' => $this->ID,
|
435 |
|
436 |
|
437 |
private function locate_template( $file ) {
|
438 |
+
$search_file = sprintf( 'ampforwp/%s', basename( $file ) );
|
439 |
return locate_template( array( $search_file ), false );
|
440 |
}
|
441 |
|
@@ -40,4 +40,5 @@ Reason: To extend the functionality of sidebars and Pagebuilder
|
|
40 |
13. Foo Gallery Support code added in class-amp-img-sanitizer.php in line no 35 #1424
|
41 |
14. Filter added in class-amp-dom-utils.php on line no 37 #1462
|
42 |
15. amp_vimeo_parse_url filter applied in class-amp-vimeo-embed.php in line no 108
|
43 |
-
16. ampforwp_end_point_controller added in amp-helper-functions on line no 15 #1561
|
|
40 |
13. Foo Gallery Support code added in class-amp-img-sanitizer.php in line no 35 #1424
|
41 |
14. Filter added in class-amp-dom-utils.php on line no 37 #1462
|
42 |
15. amp_vimeo_parse_url filter applied in class-amp-vimeo-embed.php in line no 108
|
43 |
+
16. ampforwp_end_point_controller added in amp-helper-functions on line no 15 #1561
|
44 |
+
17. folder name updated from amp to ampforwp to avoid conflict in class-amp-post-template.php on line no 440 #1742
|
@@ -125,6 +125,8 @@ function call_page_builder(){
|
|
125 |
$backendRowSetting = $containerCommonSettings;
|
126 |
unset($backendRowSetting['front_template_start']);
|
127 |
unset($backendRowSetting['front_template_end']);
|
|
|
|
|
128 |
wp_nonce_field( basename( __FILE__) , 'amp_content_editor_nonce' );
|
129 |
//'.add_query_arg('use_amp_pagebuilder','1',$url).'
|
130 |
?>
|
@@ -292,6 +294,17 @@ function call_page_builder(){
|
|
292 |
if(in_array($key, $oldModules)){
|
293 |
continue;
|
294 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
$moduleJson = array('type'=> 'module','moduleDraggable'=>true ,'modulename'=>strtolower($module['name']),'moduleJson'=>$module);
|
296 |
echo '
|
297 |
<drag class="drag" :transfer-data=\''.json_encode($moduleJson).'\' :draggable="true" :effect-allowed="\'copy\'">
|
125 |
$backendRowSetting = $containerCommonSettings;
|
126 |
unset($backendRowSetting['front_template_start']);
|
127 |
unset($backendRowSetting['front_template_end']);
|
128 |
+
unset($backendRowSetting['front_css']);
|
129 |
+
unset($backendRowSetting['front_common_css']);
|
130 |
wp_nonce_field( basename( __FILE__) , 'amp_content_editor_nonce' );
|
131 |
//'.add_query_arg('use_amp_pagebuilder','1',$url).'
|
132 |
?>
|
294 |
if(in_array($key, $oldModules)){
|
295 |
continue;
|
296 |
}
|
297 |
+
unset($module['front_template']);
|
298 |
+
unset($module['front_css']);
|
299 |
+
if(isset($module['front_loop_content'])){
|
300 |
+
unset($module['front_loop_content']);
|
301 |
+
}
|
302 |
+
if(isset($module['front_common_css'])){
|
303 |
+
unset($module['front_common_css']);
|
304 |
+
}
|
305 |
+
if(isset($module['repeater'])){
|
306 |
+
unset($module['repeater']['front_template']);
|
307 |
+
}
|
308 |
$moduleJson = array('type'=> 'module','moduleDraggable'=>true ,'modulename'=>strtolower($module['name']),'moduleJson'=>$module);
|
309 |
echo '
|
310 |
<drag class="drag" :transfer-data=\''.json_encode($moduleJson).'\' :draggable="true" :effect-allowed="\'copy\'">
|
@@ -10,8 +10,8 @@ function amppbbase_admin_scripts( $hook_suffix ){
|
|
10 |
global $moduleTemplate;
|
11 |
global $layoutTemplate;
|
12 |
/* In Page Edit Screen */
|
13 |
-
|
14 |
-
if($post_type=='post' || $post_type=='page'){
|
15 |
/* Enqueue CSS & JS For Page Builder */
|
16 |
wp_enqueue_style( 'amppb-admin', AMP_PAGE_BUILDER_URL. 'inc/admin-amp-page-builder.css', array(), AMPFORWP_VERSION );
|
17 |
wp_enqueue_media();
|
10 |
global $moduleTemplate;
|
11 |
global $layoutTemplate;
|
12 |
/* In Page Edit Screen */
|
13 |
+
if( ($post_type=='post' || $post_type=='page') && in_array( $hook_suffix, array( 'post.php', 'post-new.php' ) ) ){
|
14 |
+
//if($post_type=='post' || $post_type=='page'){
|
15 |
/* Enqueue CSS & JS For Page Builder */
|
16 |
wp_enqueue_style( 'amppb-admin', AMP_PAGE_BUILDER_URL. 'inc/admin-amp-page-builder.css', array(), AMPFORWP_VERSION );
|
17 |
wp_enqueue_media();
|
@@ -91,8 +91,8 @@ function ampforwp_get_image() {
|
|
91 |
}
|
92 |
}else{
|
93 |
$image = wp_get_attachment_image( $_GET['id'], 'full', false, array( 'id' => 'ampforwp-preview-image' ) );
|
94 |
-
$image_src =
|
95 |
-
$image_src_full =
|
96 |
$data = array(
|
97 |
'image' => $image,
|
98 |
'detail' => $image_src,
|
91 |
}
|
92 |
}else{
|
93 |
$image = wp_get_attachment_image( $_GET['id'], 'full', false, array( 'id' => 'ampforwp-preview-image' ) );
|
94 |
+
$image_src = ampforwp_get_attachment_id($_GET['id'],'thumbnail');
|
95 |
+
$image_src_full = ampforwp_get_attachment_id($_GET['id'],'full');
|
96 |
$data = array(
|
97 |
'image' => $image,
|
98 |
'detail' => $image_src,
|
@@ -5,7 +5,7 @@ Show Front Data
|
|
5 |
|
6 |
add_action('pre_amp_render_post','amp_pagebuilder_content');
|
7 |
function amp_pagebuilder_content(){
|
8 |
-
if (
|
9 |
$arr['ID'] = get_post()->ID;
|
10 |
$arr['post_content'] = ' ';
|
11 |
wp_update_post($arr);
|
@@ -123,7 +123,7 @@ function amp_pagebuilder_content_styles(){
|
|
123 |
break;
|
124 |
}
|
125 |
}
|
126 |
-
$rowCss =
|
127 |
}
|
128 |
echo amppb_validateCss($rowCss);
|
129 |
}//Row Settings Css foreach closed
|
@@ -187,7 +187,7 @@ function amp_pagebuilder_content_styles(){
|
|
187 |
break;
|
188 |
}
|
189 |
}
|
190 |
-
$completeCss =
|
191 |
}
|
192 |
echo amppb_validateCss($completeCss);
|
193 |
|
@@ -410,7 +410,7 @@ function rowData($container,$col,$moduleTemplate){
|
|
410 |
$imageWidth = $replace[1];
|
411 |
$imageHeight = $replace[2];
|
412 |
}else{
|
413 |
-
$imageDetails =
|
414 |
$imageUrl = $imageDetails[0];
|
415 |
$imageWidth = $imageDetails[1];
|
416 |
$imageHeight = $imageDetails[2];
|
@@ -431,14 +431,14 @@ function rowData($container,$col,$moduleTemplate){
|
|
431 |
$imageHeight,
|
432 |
$repeaterFrontTemplate
|
433 |
);
|
434 |
-
$repeaterFrontTemplate =
|
435 |
}else{
|
436 |
$repeaterFrontTemplate = str_replace(
|
437 |
'{{'.$moduleField['name'].'}}',
|
438 |
$replace,
|
439 |
$repeaterFrontTemplate
|
440 |
);
|
441 |
-
$repeaterFrontTemplate =
|
442 |
}
|
443 |
|
444 |
|
@@ -475,7 +475,7 @@ function rowData($container,$col,$moduleTemplate){
|
|
475 |
$totalLoopHtml = contentHtml($the_query,$fieldValues,$totalLoopHtml);
|
476 |
if(isset($moduleTemplate[$contentArray['type']]['fields']) && count($moduleTemplate[$contentArray['type']]['fields']) > 0) {
|
477 |
foreach($moduleTemplate[$contentArray['type']]['fields'] as $key => $field){
|
478 |
-
$totalLoopHtml =
|
479 |
}
|
480 |
}
|
481 |
|
@@ -486,7 +486,7 @@ function rowData($container,$col,$moduleTemplate){
|
|
486 |
wp_reset_postdata();
|
487 |
if(isset($moduleTemplate[$contentArray['type']]['fields']) && count($moduleTemplate[$contentArray['type']]['fields']) > 0) {
|
488 |
foreach($moduleTemplate[$contentArray['type']]['fields'] as $key => $field){
|
489 |
-
$moduleFrontHtml =
|
490 |
}
|
491 |
}
|
492 |
|
@@ -510,7 +510,7 @@ function rowData($container,$col,$moduleTemplate){
|
|
510 |
$imageWidth = $replace[1];
|
511 |
$imageHeight = $replace[2];
|
512 |
}else{
|
513 |
-
$imageDetails =
|
514 |
$imageUrl = $imageDetails[0];
|
515 |
$imageWidth = $imageDetails[1];
|
516 |
$imageHeight = $imageDetails[2];
|
@@ -530,33 +530,33 @@ function rowData($container,$col,$moduleTemplate){
|
|
530 |
$imageHeight,
|
531 |
$moduleFrontHtml
|
532 |
);
|
533 |
-
$moduleFrontHtml =
|
534 |
}else{
|
535 |
$moduleFrontHtml = str_replace('{{'.$field['name'].'}}', urldecode( $replace), $moduleFrontHtml);
|
536 |
-
$moduleFrontHtml =
|
537 |
}
|
538 |
}else{
|
539 |
if(count($contentArray[$field['name']])>0){
|
540 |
foreach ($contentArray[$field['name']] as $key => $userValue) {
|
541 |
if(count($contentArray[$field['name']])==1){
|
542 |
$moduleFrontHtml = str_replace('{{'.$field['name'].'}}', $userValue, $moduleFrontHtml);
|
543 |
-
$moduleFrontHtml =
|
544 |
}else{
|
545 |
$moduleFrontHtml = str_replace('{{'.$field['name'].$key.'}}', $userValue, $moduleFrontHtml);
|
546 |
-
$moduleFrontHtml =
|
547 |
}
|
548 |
}
|
549 |
|
550 |
}else{
|
551 |
$moduleFrontHtml = str_replace('{{'.$field['name'].'}}', "", $moduleFrontHtml);
|
552 |
-
$moduleFrontHtml =
|
553 |
}
|
554 |
}
|
555 |
|
556 |
|
557 |
}else{
|
558 |
$moduleFrontHtml = str_replace('{{'.$field['name'].'}}', "", $moduleFrontHtml);
|
559 |
-
$moduleFrontHtml =
|
560 |
}
|
561 |
}//If Closed content type html
|
562 |
|
@@ -599,11 +599,11 @@ function sortByIndex($contentArray){
|
|
599 |
return $contentArray;
|
600 |
}
|
601 |
}
|
602 |
-
function
|
603 |
return trim(str_replace(' ','',strip_tags($str))) == '';
|
604 |
}
|
605 |
|
606 |
-
function
|
607 |
if(filter_var($url, FILTER_VALIDATE_URL) === FALSE){
|
608 |
$attachment_id = $url;
|
609 |
}else{
|
@@ -642,7 +642,7 @@ function get_attachment_id( $url , $imagetype='full') {
|
|
642 |
return wp_get_attachment_image_src($attachment_id, $imagetype, false);
|
643 |
}
|
644 |
|
645 |
-
function
|
646 |
preg_match_all("{{if_condition_".$byReplace."==(.*?)}}", $string,$matches);
|
647 |
if(isset($matches[1]) && count($matches[1])>0){
|
648 |
$matches[1] = array_unique($matches[1]);
|
5 |
|
6 |
add_action('pre_amp_render_post','amp_pagebuilder_content');
|
7 |
function amp_pagebuilder_content(){
|
8 |
+
if (ampforwp_empty_content(get_post()->post_content)) {
|
9 |
$arr['ID'] = get_post()->ID;
|
10 |
$arr['post_content'] = ' ';
|
11 |
wp_update_post($arr);
|
123 |
break;
|
124 |
}
|
125 |
}
|
126 |
+
$rowCss = ampforwp_replaceIfContentConditional($rowfield['name'], $replaceRow, $rowCss);
|
127 |
}
|
128 |
echo amppb_validateCss($rowCss);
|
129 |
}//Row Settings Css foreach closed
|
187 |
break;
|
188 |
}
|
189 |
}
|
190 |
+
$completeCss = ampforwp_replaceIfContentConditional($modulefield['name'], $replaceModule, $completeCss);
|
191 |
}
|
192 |
echo amppb_validateCss($completeCss);
|
193 |
|
410 |
$imageWidth = $replace[1];
|
411 |
$imageHeight = $replace[2];
|
412 |
}else{
|
413 |
+
$imageDetails = ampforwp_get_attachment_id( $replace);
|
414 |
$imageUrl = $imageDetails[0];
|
415 |
$imageWidth = $imageDetails[1];
|
416 |
$imageHeight = $imageDetails[2];
|
431 |
$imageHeight,
|
432 |
$repeaterFrontTemplate
|
433 |
);
|
434 |
+
$repeaterFrontTemplate = ampforwp_replaceIfContentConditional($moduleField['name'], $imageUrl, $repeaterFrontTemplate);
|
435 |
}else{
|
436 |
$repeaterFrontTemplate = str_replace(
|
437 |
'{{'.$moduleField['name'].'}}',
|
438 |
$replace,
|
439 |
$repeaterFrontTemplate
|
440 |
);
|
441 |
+
$repeaterFrontTemplate = ampforwp_replaceIfContentConditional($moduleField['name'], $replace, $repeaterFrontTemplate);
|
442 |
}
|
443 |
|
444 |
|
475 |
$totalLoopHtml = contentHtml($the_query,$fieldValues,$totalLoopHtml);
|
476 |
if(isset($moduleTemplate[$contentArray['type']]['fields']) && count($moduleTemplate[$contentArray['type']]['fields']) > 0) {
|
477 |
foreach($moduleTemplate[$contentArray['type']]['fields'] as $key => $field){
|
478 |
+
$totalLoopHtml = ampforwp_replaceIfContentConditional($field['name'], $fieldValues[$field['name']], $totalLoopHtml);
|
479 |
}
|
480 |
}
|
481 |
|
486 |
wp_reset_postdata();
|
487 |
if(isset($moduleTemplate[$contentArray['type']]['fields']) && count($moduleTemplate[$contentArray['type']]['fields']) > 0) {
|
488 |
foreach($moduleTemplate[$contentArray['type']]['fields'] as $key => $field){
|
489 |
+
$moduleFrontHtml = ampforwp_replaceIfContentConditional($field['name'], $fieldValues[$field['name']], $moduleFrontHtml);
|
490 |
}
|
491 |
}
|
492 |
|
510 |
$imageWidth = $replace[1];
|
511 |
$imageHeight = $replace[2];
|
512 |
}else{
|
513 |
+
$imageDetails = ampforwp_get_attachment_id( $replace);
|
514 |
$imageUrl = $imageDetails[0];
|
515 |
$imageWidth = $imageDetails[1];
|
516 |
$imageHeight = $imageDetails[2];
|
530 |
$imageHeight,
|
531 |
$moduleFrontHtml
|
532 |
);
|
533 |
+
$moduleFrontHtml = ampforwp_replaceIfContentConditional($field['name'], $imageUrl, $moduleFrontHtml);
|
534 |
}else{
|
535 |
$moduleFrontHtml = str_replace('{{'.$field['name'].'}}', urldecode( $replace), $moduleFrontHtml);
|
536 |
+
$moduleFrontHtml = ampforwp_replaceIfContentConditional($field['name'], urldecode( $replace), $moduleFrontHtml);
|
537 |
}
|
538 |
}else{
|
539 |
if(count($contentArray[$field['name']])>0){
|
540 |
foreach ($contentArray[$field['name']] as $key => $userValue) {
|
541 |
if(count($contentArray[$field['name']])==1){
|
542 |
$moduleFrontHtml = str_replace('{{'.$field['name'].'}}', $userValue, $moduleFrontHtml);
|
543 |
+
$moduleFrontHtml = ampforwp_replaceIfContentConditional($field['name'], $userValue, $moduleFrontHtml);
|
544 |
}else{
|
545 |
$moduleFrontHtml = str_replace('{{'.$field['name'].$key.'}}', $userValue, $moduleFrontHtml);
|
546 |
+
$moduleFrontHtml = ampforwp_replaceIfContentConditional($field['name'].$key, $userValue, $moduleFrontHtml);
|
547 |
}
|
548 |
}
|
549 |
|
550 |
}else{
|
551 |
$moduleFrontHtml = str_replace('{{'.$field['name'].'}}', "", $moduleFrontHtml);
|
552 |
+
$moduleFrontHtml = ampforwp_replaceIfContentConditional($field['name'], "", $moduleFrontHtml);
|
553 |
}
|
554 |
}
|
555 |
|
556 |
|
557 |
}else{
|
558 |
$moduleFrontHtml = str_replace('{{'.$field['name'].'}}', "", $moduleFrontHtml);
|
559 |
+
$moduleFrontHtml = ampforwp_replaceIfContentConditional($field['name'], "", $moduleFrontHtml);
|
560 |
}
|
561 |
}//If Closed content type html
|
562 |
|
599 |
return $contentArray;
|
600 |
}
|
601 |
}
|
602 |
+
function ampforwp_empty_content($str) {
|
603 |
return trim(str_replace(' ','',strip_tags($str))) == '';
|
604 |
}
|
605 |
|
606 |
+
function ampforwp_get_attachment_id( $url , $imagetype='full') {
|
607 |
if(filter_var($url, FILTER_VALIDATE_URL) === FALSE){
|
608 |
$attachment_id = $url;
|
609 |
}else{
|
642 |
return wp_get_attachment_image_src($attachment_id, $imagetype, false);
|
643 |
}
|
644 |
|
645 |
+
function ampforwp_replaceIfContentConditional($byReplace, $replaceWith, $string){
|
646 |
preg_match_all("{{if_condition_".$byReplace."==(.*?)}}", $string,$matches);
|
647 |
if(isset($matches[1]) && count($matches[1])>0){
|
648 |
$matches[1] = array_unique($matches[1]);
|
@@ -40,8 +40,9 @@ require_once ABSPATH . WPINC . '/category.php';
|
|
40 |
$categoriesArray = array('recent_option'=>'Recent Posts');
|
41 |
$options = '<option value="recent_option">Recent Posts</option>';
|
42 |
foreach($categories as $category){
|
43 |
-
|
44 |
-
$
|
|
|
45 |
}
|
46 |
|
47 |
|
40 |
$categoriesArray = array('recent_option'=>'Recent Posts');
|
41 |
$options = '<option value="recent_option">Recent Posts</option>';
|
42 |
foreach($categories as $category){
|
43 |
+
$categoryName = htmlspecialchars($category->name, ENT_QUOTES);
|
44 |
+
$categoriesArray[$category->term_id] = $categoryName;
|
45 |
+
$options.= '<option value="'.$category->term_id.'">'.$categoryName.'</option>';
|
46 |
}
|
47 |
|
48 |
|
@@ -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: 4.9.4
|
7 |
-
Stable tag: 0.9.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -182,6 +182,29 @@ You can contact us from [here](http://ampforwp.com/contact/)
|
|
182 |
|
183 |
== Changelog ==
|
184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
= 0.9.81 (15th February 2018) =
|
186 |
* Edge case fatal error on features.php fixed
|
187 |
* Admin dashboard messup CSS fix #1731
|
4 |
Donate link: https://www.paypal.me/Kaludi/25
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 4.9.4
|
7 |
+
Stable tag: 0.9.82
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
182 |
|
183 |
== Changelog ==
|
184 |
|
185 |
+
= 0.9.82 (18th February 2018) =
|
186 |
+
* View more details on https://ampforwp.com/0-9-82-released-stability-update-82nd-update/
|
187 |
+
* Logo Resizing calculation by Pixels and resizing bug solved.
|
188 |
+
* Update Notification in the Admin panel will only appear in the AMP options panel. So it will not annoy you anymore.
|
189 |
+
* Glue underline is applying for some reason
|
190 |
+
* Fatal error after 0.9.81 fixed
|
191 |
+
* Facebook comments loading twice on swift
|
192 |
+
* PHP Notice: Undefined variable: post_author_name
|
193 |
+
* Pagebuilder fix in version 0.9.81 Compatibility with Yoast and other plugins #1749
|
194 |
+
* Home loop modifier option added. Allows you to exclude the categories from the loop or include the Custom Post type in the homepage loop.
|
195 |
+
* amphtml Conflict with Instant Article for Facebook resolved
|
196 |
+
* /amp folder in the theme is applying changes in plugin, which causing a bug, but it’s been fixed
|
197 |
+
* Backward Compatibility for AMP Preview
|
198 |
+
* SEO Section Improvements
|
199 |
+
* Wrong comments count on AMP pages
|
200 |
+
* AMP Allow selector in the The Content. You can add tabs and AMP components directly into the loop.
|
201 |
+
* If we turn off the Homepage Support then Blog is turned off as well, solved.
|
202 |
+
* Post Pagination have two options like “Number of pages” and Previous & Next.
|
203 |
+
* Removed the dot from the one Signal Service worker URL if the subdomain isn’t added (Causes Validation issues.)
|
204 |
+
* Extra Space due to empty divs in Design 3
|
205 |
+
* Remove alt from a tag in the AMP version caused many validation issues.
|
206 |
+
|
207 |
+
|
208 |
= 0.9.81 (15th February 2018) =
|
209 |
* Edge case fatal error on features.php fixed
|
210 |
* Admin dashboard messup CSS fix #1731
|
@@ -193,6 +193,9 @@ if( !is_home() && $redux_builder_amp['ampforwp-bread-crumb'] == 1 ) { ?>
|
|
193 |
.amp-carousel-container {position: relative;width: 100%;height: 100%;}
|
194 |
.amp-carousel-img img {object-fit: contain;}
|
195 |
<?php // Ads (sitewide)
|
196 |
-
if( ( isset($redux_builder_amp['enable-amp-ads-1'] ) && $redux_builder_amp['enable-amp-ads-1'] ) || ( isset($redux_builder_amp['enable-amp-ads-2'] ) && $redux_builder_amp['enable-amp-ads-2'] ) ){ ?> .amp-ad-wrapper {text-align: center} .amp-ad-wrapper.amp_ad_1{padding-top:20px} .amp-ad-wrapper,.amp-wp-article amp-ad{ direction: ltr; } <?php }
|
|
|
|
|
|
|
197 |
echo $redux_builder_amp['css_editor'];
|
198 |
//} ?>
|
193 |
.amp-carousel-container {position: relative;width: 100%;height: 100%;}
|
194 |
.amp-carousel-img img {object-fit: contain;}
|
195 |
<?php // Ads (sitewide)
|
196 |
+
if( ( isset($redux_builder_amp['enable-amp-ads-1'] ) && $redux_builder_amp['enable-amp-ads-1'] ) || ( isset($redux_builder_amp['enable-amp-ads-2'] ) && $redux_builder_amp['enable-amp-ads-2'] ) ){ ?> .amp-ad-wrapper {text-align: center} .amp-ad-wrapper.amp_ad_1{padding-top:20px} .amp-ad-wrapper,.amp-wp-article amp-ad{ direction: ltr; } <?php }
|
197 |
+
if ( true == $redux_builder_amp['amp-pagination'] ) { ?>
|
198 |
+
.ampforwp_post_pagination{width:100%;text-align:center;display:inline-block;}
|
199 |
+
<?php }
|
200 |
echo $redux_builder_amp['css_editor'];
|
201 |
//} ?>
|
@@ -336,6 +336,9 @@ amp-user-notification button { background-color: <?php echo sanitize_hex_color(
|
|
336 |
.amp-carousel-container {position: relative;width: 100%;height: 100%;}
|
337 |
.amp-carousel-img img {object-fit: contain;}
|
338 |
<?php // Ads (sitewide)
|
339 |
-
if( ( isset($redux_builder_amp['enable-amp-ads-1'] ) && $redux_builder_amp['enable-amp-ads-1'] ) || ( isset($redux_builder_amp['enable-amp-ads-2'] ) && $redux_builder_amp['enable-amp-ads-2'] ) ){ ?> .amp-ad-wrapper{ text-align: center } .amp-ad-wrapper{ text-align: center; margin-left: -13px; } .amp-ad-wrapper, .amp-wp-article amp-ad{ direction: ltr; } .amp-ad-2{ margin-bottom: 50px; } .amp_home_body .amp_ad_1{ margin-top: 10px; margin-bottom: -20px; }<?php }
|
|
|
|
|
|
|
340 |
echo $redux_builder_amp['css_editor'];
|
341 |
//} ?>
|
336 |
.amp-carousel-container {position: relative;width: 100%;height: 100%;}
|
337 |
.amp-carousel-img img {object-fit: contain;}
|
338 |
<?php // Ads (sitewide)
|
339 |
+
if( ( isset($redux_builder_amp['enable-amp-ads-1'] ) && $redux_builder_amp['enable-amp-ads-1'] ) || ( isset($redux_builder_amp['enable-amp-ads-2'] ) && $redux_builder_amp['enable-amp-ads-2'] ) ){ ?> .amp-ad-wrapper{ text-align: center } .amp-ad-wrapper{ text-align: center; margin-left: -13px; } .amp-ad-wrapper, .amp-wp-article amp-ad{ direction: ltr; } .amp-ad-2{ margin-bottom: 50px; } .amp_home_body .amp_ad_1{ margin-top: 10px; margin-bottom: -20px; }<?php }
|
340 |
+
if ( true == $redux_builder_amp['amp-pagination'] ) { ?>
|
341 |
+
.ampforwp_post_pagination{width:100%;text-align:center;display:inline-block;}
|
342 |
+
<?php }
|
343 |
echo $redux_builder_amp['css_editor'];
|
344 |
//} ?>
|
@@ -258,7 +258,7 @@ pre{ white-space: pre-wrap; }
|
|
258 |
.amp-category-block li:nth-child(3){ margin: 0 1%; }
|
259 |
.searchmenu{ margin-right: 15px; margin-top: 11px; position: absolute; top: 0; right: 0; }
|
260 |
.searchmenu button{ background:transparent; border:none }
|
261 |
-
.amp-logo amp-img{margin: 0 auto; position:relative;top:9px;}
|
262 |
.headerlogo{ margin: 0 auto; width: 80%; text-align: center; }
|
263 |
.headerlogo a{ color:#F42; display:inline-block}
|
264 |
|
@@ -455,6 +455,9 @@ if ( ! is_home() && 1 == $redux_builder_amp['ampforwp-bread-crumb'] ) { ?>
|
|
455 |
.amp-carousel-container {position: relative;width: 100%;height: 100%;}
|
456 |
.amp-carousel-img img {object-fit: contain;}
|
457 |
<?php // Ads (sitewide)
|
458 |
-
if ( (isset($redux_builder_amp['enable-amp-ads-1'] ) && $redux_builder_amp['enable-amp-ads-1']) || (isset($redux_builder_amp['enable-amp-ads-2'] ) && $redux_builder_amp['enable-amp-ads-2']) ) { ?> .amp-ad-wrapper{ text-align: center } .amp_ad_1{ margin-top: 15px; margin-bottom: 10px; } .single-post .amp_ad_1{ margin-bottom: -15px; } .amp-ad-2{ margin-bottom: -5px; margin-top: 20px; } .amp-ad-wrapper{ text-align: center; margin-left: -13px; }.amp-ad-wrapper, .amp-wp-article amp-ad{ direction: ltr; } <?php }
|
|
|
|
|
|
|
459 |
echo $redux_builder_amp['css_editor'];
|
460 |
//} ?>
|
258 |
.amp-category-block li:nth-child(3){ margin: 0 1%; }
|
259 |
.searchmenu{ margin-right: 15px; margin-top: 11px; position: absolute; top: 0; right: 0; }
|
260 |
.searchmenu button{ background:transparent; border:none }
|
261 |
+
.amp-logo amp-img{margin: 0 auto; position:relative;top:9px;max-width:190px;}
|
262 |
.headerlogo{ margin: 0 auto; width: 80%; text-align: center; }
|
263 |
.headerlogo a{ color:#F42; display:inline-block}
|
264 |
|
455 |
.amp-carousel-container {position: relative;width: 100%;height: 100%;}
|
456 |
.amp-carousel-img img {object-fit: contain;}
|
457 |
<?php // Ads (sitewide)
|
458 |
+
if ( (isset($redux_builder_amp['enable-amp-ads-1'] ) && $redux_builder_amp['enable-amp-ads-1']) || (isset($redux_builder_amp['enable-amp-ads-2'] ) && $redux_builder_amp['enable-amp-ads-2']) ) { ?> .amp-ad-wrapper{ text-align: center } .amp_ad_1{ margin-top: 15px; margin-bottom: 10px; } .single-post .amp_ad_1{ margin-bottom: -15px; } .amp-ad-2{ margin-bottom: -5px; margin-top: 20px; } .amp-ad-wrapper{ text-align: center; margin-left: -13px; }.amp-ad-wrapper, .amp-wp-article amp-ad{ direction: ltr; } <?php }
|
459 |
+
if ( true == $redux_builder_amp['amp-pagination'] ) { ?>
|
460 |
+
.ampforwp_post_pagination{width:100%;text-align:center;display:inline-block;}
|
461 |
+
<?php }
|
462 |
echo $redux_builder_amp['css_editor'];
|
463 |
//} ?>
|
@@ -186,7 +186,7 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
|
|
186 |
if ( $ampforwp_is_amp_endpoint ) {
|
187 |
amp_prepare_render();
|
188 |
} else {
|
189 |
-
add_action( 'wp_head', 'ampforwp_home_archive_rel_canonical' );
|
190 |
}
|
191 |
|
192 |
$cpage_var = get_query_var('cpage');
|
@@ -204,7 +204,7 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
|
|
204 |
if( is_attachment() ) {
|
205 |
return;
|
206 |
}
|
207 |
-
if( is_home() && !$redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
|
208 |
return;
|
209 |
}
|
210 |
if( is_front_page() && ! $redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
|
@@ -1134,6 +1134,8 @@ function ampforwp_new_dir( $dir ) {
|
|
1134 |
$content = preg_replace('/readability=[^>]*/', '', $content);
|
1135 |
// removing color from span tag
|
1136 |
$content = preg_replace('/<span(.*?)(color=".*?")(.*?)>/', '<span$1$3>', $content);
|
|
|
|
|
1137 |
// removing sl-processed attribute
|
1138 |
$content = preg_replace('/(<[^>]+) sl-processed=".*?"/', '$1', $content);
|
1139 |
// ga-on
|
@@ -2374,7 +2376,7 @@ function ampforwp_add_disqus_support() {
|
|
2374 |
//if ( !comments_open() ){
|
2375 |
// return;
|
2376 |
//}//931
|
2377 |
-
if ( $redux_builder_amp['ampforwp-disqus-comments-support'] ) {
|
2378 |
if( $redux_builder_amp['ampforwp-disqus-comments-name'] !== '' ) {
|
2379 |
global $post; $post_slug=$post->post_name;
|
2380 |
|
@@ -2421,7 +2423,10 @@ function ampforwp_add_disqus_scripts( $data ) {
|
|
2421 |
|
2422 |
add_action('ampforwp_post_after_design_elements','ampforwp_facebook_comments_support');
|
2423 |
function ampforwp_facebook_comments_support() {
|
2424 |
-
|
|
|
|
|
|
|
2425 |
}
|
2426 |
function ampforwp_facebook_comments_markup() {
|
2427 |
|
@@ -2701,13 +2706,14 @@ function ampforwp_output_widget_content_below_the_header() {
|
|
2701 |
if ( $sanitized_sidebar) {
|
2702 |
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
2703 |
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
|
2704 |
-
}
|
2705 |
-
|
2706 |
-
<div class="
|
2707 |
-
|
2708 |
-
|
2709 |
-
|
2710 |
-
<?php }
|
|
|
2711 |
|
2712 |
add_action( 'amp_post_template_above_footer' , 'ampforwp_output_widget_content_above_the_footer' );
|
2713 |
function ampforwp_output_widget_content_above_the_footer() {
|
@@ -2717,13 +2723,14 @@ function ampforwp_output_widget_content_above_the_footer() {
|
|
2717 |
if ( $sanitized_sidebar) {
|
2718 |
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
2719 |
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
|
2720 |
-
}
|
2721 |
-
|
2722 |
-
|
2723 |
-
|
2724 |
-
|
2725 |
-
|
2726 |
-
<?php }
|
|
|
2727 |
// Filter the sidebars content to make it work properly with carousels
|
2728 |
add_filter('ampforwp_modify_sidebars_content','ampforwp_sidebars_carousel_content');
|
2729 |
function ampforwp_sidebars_carousel_content($content){
|
@@ -3753,8 +3760,8 @@ function ampforwp_post_pagination( $args = '' ) {
|
|
3753 |
'link_after' => '',
|
3754 |
'next_or_number' => 'number',
|
3755 |
'separator' => ' ',
|
3756 |
-
'nextpagelink' => __( 'Next
|
3757 |
-
'previouspagelink' => __( 'Previous
|
3758 |
'pagelink' => '%',
|
3759 |
'echo' => 1
|
3760 |
);
|
@@ -3766,7 +3773,11 @@ function ampforwp_post_pagination( $args = '' ) {
|
|
3766 |
* @param array $params An array of arguments for page links for paginated posts.
|
3767 |
*/
|
3768 |
$r = apply_filters( 'ampforwp_post_pagination_args', $params );
|
3769 |
-
|
|
|
|
|
|
|
|
|
3770 |
$output = '';
|
3771 |
if ( $multipage ) {
|
3772 |
if ( 'number' == $r['next_or_number'] ) {
|
@@ -3795,11 +3806,12 @@ function ampforwp_post_pagination( $args = '' ) {
|
|
3795 |
$link = ampforwp_post_paginated_link_generator( $prev ) . $r['link_before'] . $r['previouspagelink'] . $r['link_after'] . '</a>';
|
3796 |
$output .= apply_filters( 'ampforwp_post_pagination_link', $link, $prev );
|
3797 |
}
|
|
|
|
|
|
|
3798 |
$next = $page + 1;
|
3799 |
if ( $next <= $numpages ) {
|
3800 |
-
|
3801 |
-
$output .= $r['separator'];
|
3802 |
-
}
|
3803 |
$link = ampforwp_post_paginated_link_generator( $next ) . $r['link_before'] . $r['nextpagelink'] . $r['link_after'] . '</a>';
|
3804 |
$output .= apply_filters( 'ampforwp_post_pagination_link', $link, $next );
|
3805 |
}
|
@@ -5198,9 +5210,12 @@ if( ! function_exists( ' ampforwp_onesignal_notifications ' ) ){
|
|
5198 |
// HTTP sites
|
5199 |
if(isset($redux_builder_amp['ampforwp-onesignal-http-site'] ) && $redux_builder_amp['ampforwp-onesignal-http-site'] ){
|
5200 |
$onesignal_subdomain = $redux_builder_amp['ampforwp-onesignal-subdomain'];
|
5201 |
-
|
5202 |
-
|
5203 |
-
|
|
|
|
|
|
|
5204 |
} ?>
|
5205 |
<amp-web-push
|
5206 |
id="amp-web-push"
|
@@ -5787,4 +5802,128 @@ function ampforwp_end_point_controller( $url, $check='' ) {
|
|
5787 |
$url = $url . user_trailingslashit( AMP_QUERY_VAR, 'single_amp' );
|
5788 |
|
5789 |
return $url;
|
5790 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
if ( $ampforwp_is_amp_endpoint ) {
|
187 |
amp_prepare_render();
|
188 |
} else {
|
189 |
+
add_action( 'wp_head', 'ampforwp_home_archive_rel_canonical', 1 );
|
190 |
}
|
191 |
|
192 |
$cpage_var = get_query_var('cpage');
|
204 |
if( is_attachment() ) {
|
205 |
return;
|
206 |
}
|
207 |
+
if( is_home() && is_front_page() && !$redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
|
208 |
return;
|
209 |
}
|
210 |
if( is_front_page() && ! $redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
|
1134 |
$content = preg_replace('/readability=[^>]*/', '', $content);
|
1135 |
// removing color from span tag
|
1136 |
$content = preg_replace('/<span(.*?)(color=".*?")(.*?)>/', '<span$1$3>', $content);
|
1137 |
+
// removing alt from a tag
|
1138 |
+
$content = preg_replace('/<a(.*?)(alt=".*?")(.*?)>/', '<a$1$3>', $content);
|
1139 |
// removing sl-processed attribute
|
1140 |
$content = preg_replace('/(<[^>]+) sl-processed=".*?"/', '$1', $content);
|
1141 |
// ga-on
|
2376 |
//if ( !comments_open() ){
|
2377 |
// return;
|
2378 |
//}//931
|
2379 |
+
if ( $redux_builder_amp['ampforwp-disqus-comments-support'] && 4 != $redux_builder_amp['amp-design-selector'] ) {
|
2380 |
if( $redux_builder_amp['ampforwp-disqus-comments-name'] !== '' ) {
|
2381 |
global $post; $post_slug=$post->post_name;
|
2382 |
|
2423 |
|
2424 |
add_action('ampforwp_post_after_design_elements','ampforwp_facebook_comments_support');
|
2425 |
function ampforwp_facebook_comments_support() {
|
2426 |
+
global $redux_builder_amp;
|
2427 |
+
if ( 4 != $redux_builder_amp['amp-design-selector'] ) {
|
2428 |
+
echo ampforwp_facebook_comments_markup();
|
2429 |
+
}
|
2430 |
}
|
2431 |
function ampforwp_facebook_comments_markup() {
|
2432 |
|
2706 |
if ( $sanitized_sidebar) {
|
2707 |
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
2708 |
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
|
2709 |
+
}
|
2710 |
+
if ( $sidebar_output ) { ?>
|
2711 |
+
<div class="amp-wp-content widget-wrapper">
|
2712 |
+
<div class="amp_widget_below_the_header">
|
2713 |
+
<?php echo $sidebar_output; ?> </div>
|
2714 |
+
</div>
|
2715 |
+
<?php }
|
2716 |
+
}
|
2717 |
|
2718 |
add_action( 'amp_post_template_above_footer' , 'ampforwp_output_widget_content_above_the_footer' );
|
2719 |
function ampforwp_output_widget_content_above_the_footer() {
|
2723 |
if ( $sanitized_sidebar) {
|
2724 |
$sidebar_output = $sanitized_sidebar->get_amp_content();
|
2725 |
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
|
2726 |
+
}
|
2727 |
+
if ( $sidebar_output ) { ?>
|
2728 |
+
<div class="amp-wp-content widget-wrapper">
|
2729 |
+
<div class="amp_widget_above_the_footer">
|
2730 |
+
<?php echo $sidebar_output; ?> </div>
|
2731 |
+
</div>
|
2732 |
+
<?php }
|
2733 |
+
}
|
2734 |
// Filter the sidebars content to make it work properly with carousels
|
2735 |
add_filter('ampforwp_modify_sidebars_content','ampforwp_sidebars_carousel_content');
|
2736 |
function ampforwp_sidebars_carousel_content($content){
|
3760 |
'link_after' => '',
|
3761 |
'next_or_number' => 'number',
|
3762 |
'separator' => ' ',
|
3763 |
+
'nextpagelink' => __( 'Next' ),
|
3764 |
+
'previouspagelink' => __( 'Previous' ),
|
3765 |
'pagelink' => '%',
|
3766 |
'echo' => 1
|
3767 |
);
|
3773 |
* @param array $params An array of arguments for page links for paginated posts.
|
3774 |
*/
|
3775 |
$r = apply_filters( 'ampforwp_post_pagination_args', $params );
|
3776 |
+
if ( isset($redux_builder_amp['ampforwp-pagination-select']) && 2 == $redux_builder_amp['ampforwp-pagination-select'] ) {
|
3777 |
+
$r['next_or_number'] = 'next';
|
3778 |
+
$r['before'] = '<div class="ampforwp_post_pagination" ><p>';
|
3779 |
+
$r['after'] = '</p></div>';
|
3780 |
+
}
|
3781 |
$output = '';
|
3782 |
if ( $multipage ) {
|
3783 |
if ( 'number' == $r['next_or_number'] ) {
|
3806 |
$link = ampforwp_post_paginated_link_generator( $prev ) . $r['link_before'] . $r['previouspagelink'] . $r['link_after'] . '</a>';
|
3807 |
$output .= apply_filters( 'ampforwp_post_pagination_link', $link, $prev );
|
3808 |
}
|
3809 |
+
$output .= $r['separator'];
|
3810 |
+
$text = $page . ' of ' . $numpages;
|
3811 |
+
$output .= apply_filters( 'ampforwp_post_pagination_page', $text, $page, $numpages);
|
3812 |
$next = $page + 1;
|
3813 |
if ( $next <= $numpages ) {
|
3814 |
+
$output .= $r['separator'];
|
|
|
|
|
3815 |
$link = ampforwp_post_paginated_link_generator( $next ) . $r['link_before'] . $r['nextpagelink'] . $r['link_after'] . '</a>';
|
3816 |
$output .= apply_filters( 'ampforwp_post_pagination_link', $link, $next );
|
3817 |
}
|
5210 |
// HTTP sites
|
5211 |
if(isset($redux_builder_amp['ampforwp-onesignal-http-site'] ) && $redux_builder_amp['ampforwp-onesignal-http-site'] ){
|
5212 |
$onesignal_subdomain = $redux_builder_amp['ampforwp-onesignal-subdomain'];
|
5213 |
+
if ( $onesignal_subdomain ) {
|
5214 |
+
$onesignal_subdomain = $onesignal_subdomain.'.';
|
5215 |
+
}
|
5216 |
+
$helper_iframe_url = 'https://' . $onesignal_subdomain . 'os.tc/amp/helper_frame?appId=' . $onesignal_app_id . '';
|
5217 |
+
$permission_dialog_url = 'https://' . $onesignal_subdomain . 'os.tc/amp/permission_dialog?appId=' . $onesignal_app_id . '';
|
5218 |
+
$service_worker_url = 'https://' . $onesignal_subdomain . 'os.tc/OneSignalSDKWorker.js?appId=' . $onesignal_app_id . '';
|
5219 |
} ?>
|
5220 |
<amp-web-push
|
5221 |
id="amp-web-push"
|
5802 |
$url = $url . user_trailingslashit( AMP_QUERY_VAR, 'single_amp' );
|
5803 |
|
5804 |
return $url;
|
5805 |
+
}
|
5806 |
+
|
5807 |
+
// Allow AMP Components in "The Content" #1588
|
5808 |
+
// Check for amp-components in the_content
|
5809 |
+
add_filter('the_content','ampforwp_amp_component_checker');
|
5810 |
+
if ( ! function_exists('ampforwp_amp_component_checker') ) {
|
5811 |
+
function ampforwp_amp_component_checker( $content ) {
|
5812 |
+
if ( function_exists('ampforwp_is_amp_endpoint') && ampforwp_is_amp_endpoint() ) {
|
5813 |
+
global $post;
|
5814 |
+
$dom = '';
|
5815 |
+
$dom = AMP_DOM_Utils::get_dom_from_content($content);
|
5816 |
+
$components = ampforwp_get_amp_components();
|
5817 |
+
foreach ( $components as $component ) {
|
5818 |
+
$nodes = $dom->getElementsByTagName( $component );
|
5819 |
+
$num_nodes = $nodes->length;
|
5820 |
+
if ( 0 !== $num_nodes ) {
|
5821 |
+
update_post_meta($post->ID,'ampforwp-wpautop', 'false');
|
5822 |
+
// Update the Post meta with amp-component
|
5823 |
+
update_post_meta($post->ID, $component , 'true');
|
5824 |
+
}
|
5825 |
+
}
|
5826 |
+
$content = AMP_DOM_Utils::get_content_from_dom($dom);
|
5827 |
+
return $content;
|
5828 |
+
}
|
5829 |
+
else
|
5830 |
+
return $content;
|
5831 |
+
}
|
5832 |
+
}
|
5833 |
+
|
5834 |
+
// Remove wpautop from specific posts which contain amp-components
|
5835 |
+
remove_filter('the_content', 'wpautop');
|
5836 |
+
add_filter('the_content', 'ampforwp_custom_wpautop');
|
5837 |
+
if ( ! function_exists('ampforwp_custom_wpautop') ) {
|
5838 |
+
function ampforwp_custom_wpautop( $content ) {
|
5839 |
+
global $post;
|
5840 |
+
if ( get_post_meta(get_the_ID(), 'ampforwp-wpautop', true) == 'false' && function_exists('ampforwp_is_amp_endpoint') && ampforwp_is_amp_endpoint() ) {
|
5841 |
+
return $content;
|
5842 |
+
}
|
5843 |
+
else
|
5844 |
+
return wpautop($content);
|
5845 |
+
}
|
5846 |
+
}
|
5847 |
+
// Get the AMP components
|
5848 |
+
function ampforwp_get_amp_components() {
|
5849 |
+
$components = array();
|
5850 |
+
$components = array('amp-carousel','amp-selector');
|
5851 |
+
return $components;
|
5852 |
+
}
|
5853 |
+
// Add the required scripts for amp-components
|
5854 |
+
add_filter('amp_post_template_data', 'ampforwp_add_amp_component_scripts',PHP_INT_MAX);
|
5855 |
+
if ( ! function_exists('ampforwp_add_amp_component_scripts') ) {
|
5856 |
+
function ampforwp_add_amp_component_scripts( $data ) {
|
5857 |
+
$components = ampforwp_get_amp_components();
|
5858 |
+
foreach ( $components as $component ) {
|
5859 |
+
// check if the post has amp-component meta
|
5860 |
+
$post_meta = get_post_meta(get_the_ID(), $component , true);
|
5861 |
+
if ( 'true' == $post_meta ) {
|
5862 |
+
if ( empty( $data['amp_component_scripts'][$component] ) ) {
|
5863 |
+
$data['amp_component_scripts'][$component] = 'https://cdn.ampproject.org/v0/'.$component.'-0.1.js';
|
5864 |
+
}
|
5865 |
+
}
|
5866 |
+
}
|
5867 |
+
return $data;
|
5868 |
+
}
|
5869 |
+
}
|
5870 |
+
|
5871 |
+
// Backward Compatibility for AMP Preview #1529
|
5872 |
+
if ( ! function_exists('get_preview_post_link') ) {
|
5873 |
+
function get_preview_post_link( $post = null, $query_args = array(), $preview_link = '' ) {
|
5874 |
+
$post = get_post( $post );
|
5875 |
+
if ( ! $post ) {
|
5876 |
+
return;
|
5877 |
+
}
|
5878 |
+
|
5879 |
+
$post_type_object = get_post_type_object( $post->post_type );
|
5880 |
+
if ( is_post_type_viewable( $post_type_object ) ) {
|
5881 |
+
if ( ! $preview_link ) {
|
5882 |
+
$preview_link = set_url_scheme( get_permalink( $post ) );
|
5883 |
+
}
|
5884 |
+
|
5885 |
+
$query_args['preview'] = 'true';
|
5886 |
+
$preview_link = add_query_arg( $query_args, $preview_link );
|
5887 |
+
}
|
5888 |
+
return apply_filters( 'preview_post_link', $preview_link, $post );
|
5889 |
+
}
|
5890 |
+
}
|
5891 |
+
|
5892 |
+
// Homepage Loop Modifier #1701
|
5893 |
+
add_filter('ampforwp_query_args','ampforwp_homepage_loop');
|
5894 |
+
function ampforwp_homepage_loop( $args ) {
|
5895 |
+
global $redux_builder_amp;
|
5896 |
+
if ( is_home() ) {
|
5897 |
+
$post_type = 'post';
|
5898 |
+
// Check if Custom Post Type is selected
|
5899 |
+
if ( isset($redux_builder_amp['ampforwp-homepage-loop-type']) && '' != $redux_builder_amp['ampforwp-homepage-loop-type'] ) {
|
5900 |
+
$post_type = $redux_builder_amp['ampforwp-homepage-loop-type'];
|
5901 |
+
}
|
5902 |
+
$args['post_type'] = $post_type;
|
5903 |
+
// Exclude Categories if any selected
|
5904 |
+
if ( isset($redux_builder_amp['ampforwp-homepage-loop-cats']) && ! empty($redux_builder_amp['ampforwp-homepage-loop-cats']) ) {
|
5905 |
+
$args['category__not_in'] = $redux_builder_amp['ampforwp-homepage-loop-cats'];
|
5906 |
+
}
|
5907 |
+
}
|
5908 |
+
return $args;
|
5909 |
+
}
|
5910 |
+
// To get correct comments count #1662
|
5911 |
+
add_filter('get_comments_number', 'ampforwp_comment_count', 0);
|
5912 |
+
function ampforwp_comment_count( $count ) {
|
5913 |
+
if ( ! is_admin() && function_exists('ampforwp_is_amp_endpoint') && ampforwp_is_amp_endpoint() ) {
|
5914 |
+
global $id;
|
5915 |
+
$get_comments = get_comments('status=approve&post_id=' . $id);
|
5916 |
+
$comments_by_type = separate_comments($get_comments);
|
5917 |
+
return count($comments_by_type['comment']);
|
5918 |
+
}
|
5919 |
+
else {
|
5920 |
+
return $count;
|
5921 |
+
}
|
5922 |
+
}
|
5923 |
+
// Glue underline css compatibility #1743
|
5924 |
+
add_action('amp_post_template_css', 'ampforwp_glue_css_comp', PHP_INT_MAX );
|
5925 |
+
if ( ! function_exists('ampforwp_glue_css_comp') ) {
|
5926 |
+
function ampforwp_glue_css_comp() { ?>
|
5927 |
+
a {text-decoration:none;}
|
5928 |
+
<?php }
|
5929 |
+
}
|