This commit is contained in:
2024-06-16 20:33:37 +03:00
parent 5896a8d1c6
commit d7584deff0
3 changed files with 60 additions and 0 deletions

39
single-amp.php Normal file
View File

@@ -0,0 +1,39 @@
<?php
// Включение стилей AMP
function theme_amp_styles() {
wp_enqueue_style('theme-amp-style', get_template_directory_uri() . '/amp.css');
}
add_action('amp_post_template_css', 'theme_amp_styles');
// Начало AMP страницы
?>
<!doctype html>
<html amp>
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<title><?php the_title(); ?></title>
<link rel="canonical" href="<?php echo esc_url(get_permalink()); ?>">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-custom>
<?php
// Включение стилей из amp.css
readfile(get_template_directory() . '/amp.css');
?>
</style>
</head>
<body>
<article>
<header>
<h1><?php the_title(); ?></h1>
</header>
<div>
<?php
while (have_posts()) : the_post();
the_content();
endwhile;
?>
</div>
</article>
</body>
</html>