diff --git a/footer.php b/footer.php index e823a50..6621bab 100644 --- a/footer.php +++ b/footer.php @@ -301,6 +301,7 @@ document.write(' + diff --git a/functions.php b/functions.php index 829e78e..5447b6f 100644 --- a/functions.php +++ b/functions.php @@ -989,6 +989,37 @@ function adddr_hash(){ } +//AMP + +function add_amp_endpoint() { + add_rewrite_endpoint('amp', EP_PERMALINK); +} +add_action('init', 'add_amp_endpoint'); + + + +function custom_amp_template($template) { + + if ( is_singular('post') && (isset($_GET['amp']) && $_GET['amp'] === '1')) { + $new_template = locate_template(array('single-amp.php')); + if (!empty($new_template)) { + return $new_template; + } + } + return $template; +} +add_filter('template_include', 'custom_amp_template'); + +function custom_amp_link() { + if (is_single()) { + $amp_url = get_permalink() . 'amp=1'; + echo ''; + } +} +add_action('wp_head', 'custom_amp_link'); + + + // Пример замены изображений на AMP-изображения в контенте поста function convert_images_to_amp($content) { if (function_exists('is_amp_endpoint') && is_amp_endpoint()) { diff --git a/page-subscript.php b/page-subscript.php index e3487c5..7c747ee 100644 --- a/page-subscript.php +++ b/page-subscript.php @@ -8,7 +8,6 @@ get_header();
Не можем подтвердить ваши данные. Пожалуйста, повторите попытку.

'; +} elseif ( !isset($_POST['subscription_nonce']) || !wp_verify_nonce($_POST['subscription_nonce'], 'subscription_form_nonce') ) { echo ('

Неверный запрос. Пожалуйста, повторите попытку.

'); } -elseif( !isset($_POST['addrr']) || $_POST['addrr'] !== adddr_hash() ){ +elseif( !isset($_POST['addrhash']) || $_POST['addrhash'] !== adddr_hash() ){ echo '

Не можем опеределить ваши данные. Пожалуйста, повторите попытку.

'; } diff --git a/partials/formhash.php b/partials/formhash.php new file mode 100755 index 0000000..a1687d8 --- /dev/null +++ b/partials/formhash.php @@ -0,0 +1,25 @@ + + + diff --git a/partials/formsubscript.php b/partials/formsubscript.php index ca00d96..9d20a64 100755 --- a/partials/formsubscript.php +++ b/partials/formsubscript.php @@ -2,14 +2,10 @@
-
+ - - - - +
diff --git a/single-amp.php b/single-amp.php index df9aa0d..48b9399 100644 --- a/single-amp.php +++ b/single-amp.php @@ -1,12 +1,3 @@ - @@ -16,10 +7,17 @@ add_action('amp_post_template_css', 'theme_amp_styles');