add hidden inputs in form
This commit is contained in:
@@ -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 '<link rel="amphtml" href="' . esc_url($amp_url) . '">';
|
||||
}
|
||||
}
|
||||
add_action('wp_head', 'custom_amp_link');
|
||||
|
||||
|
||||
|
||||
// Пример замены изображений на AMP-изображения в контенте поста
|
||||
function convert_images_to_amp($content) {
|
||||
if (function_exists('is_amp_endpoint') && is_amp_endpoint()) {
|
||||
|
||||
Reference in New Issue
Block a user