From d7584deff038b584c6d858cebb201225b9f819aa Mon Sep 17 00:00:00 2001 From: Turing Date: Sun, 16 Jun 2024 20:33:37 +0300 Subject: [PATCH] add amp --- amp.css | 7 +++++++ functions.php | 14 ++++++++++++++ single-amp.php | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 amp.css create mode 100644 single-amp.php diff --git a/amp.css b/amp.css new file mode 100644 index 0000000..368c8c1 --- /dev/null +++ b/amp.css @@ -0,0 +1,7 @@ +body { + font-family: Arial, sans-serif; + padding: 20px; +} +h1 { + color: #333; +} diff --git a/functions.php b/functions.php index 52205c2..829e78e 100644 --- a/functions.php +++ b/functions.php @@ -988,3 +988,17 @@ function adddr_hash(){ } + +// Пример замены изображений на AMP-изображения в контенте поста +function convert_images_to_amp($content) { + if (function_exists('is_amp_endpoint') && is_amp_endpoint()) { + $content = preg_replace( + '//i', + '', + $content + ); + } + return $content; +} +add_filter('the_content', 'convert_images_to_amp'); + diff --git a/single-amp.php b/single-amp.php new file mode 100644 index 0000000..df9aa0d --- /dev/null +++ b/single-amp.php @@ -0,0 +1,39 @@ + + + + + + + <?php the_title(); ?> + + + + + +
+
+

+
+
+ +
+
+ +