40 lines
1.0 KiB
PHP
40 lines
1.0 KiB
PHP
<?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>
|