add amp
This commit is contained in:
39
single-amp.php
Normal file
39
single-amp.php
Normal 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>
|
||||
Reference in New Issue
Block a user