Anton | натяжка страницы test1

This commit is contained in:
2026-04-01 23:42:02 +03:00
parent a766acdc90
commit 0d65ded3cf
6 changed files with 2538 additions and 10 deletions

View File

@@ -204,3 +204,73 @@ if ( ! function_exists( 'twentytwentyfour_pattern_categories' ) ) :
endif;
add_action( 'init', 'twentytwentyfour_pattern_categories' );
/**
* Use a standalone PHP template for the page slug "test1".
*
* @since Twenty Twenty-Four 1.0
*
* @param string $template Resolved template path.
* @return string
*/
function twentytwentyfour_test1_template( $template ) {
if ( ! is_page( 'test1' ) ) {
return $template;
}
$custom_template = get_theme_file_path( 'page-test1.php' );
if ( file_exists( $custom_template ) ) {
return $custom_template;
}
return $template;
}
add_filter( 'template_include', 'twentytwentyfour_test1_template' );
/**
* Enqueue standalone landing assets for the page slug "test1".
*
* @since Twenty Twenty-Four 1.0
* @return void
*/
function twentytwentyfour_test1_assets() {
if ( ! is_page( 'test1' ) ) {
return;
}
$css_file = ABSPATH . 'index3.css';
$js_file = ABSPATH . 'index3.js';
wp_dequeue_style( 'global-styles' );
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'classic-theme-styles' );
wp_enqueue_style(
'twentytwentyfour-test1-fonts',
'https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;700;800&display=swap',
array(),
null
);
if ( file_exists( $css_file ) ) {
wp_enqueue_style(
'twentytwentyfour-test1-style',
home_url( '/index3.css' ),
array( 'twentytwentyfour-test1-fonts' ),
(string) filemtime( $css_file )
);
}
if ( file_exists( $js_file ) ) {
wp_enqueue_script(
'twentytwentyfour-test1-script',
home_url( '/index3.js' ),
array(),
(string) filemtime( $js_file ),
true
);
}
}
add_action( 'wp_enqueue_scripts', 'twentytwentyfour_test1_assets', 100 );

View File

@@ -0,0 +1,36 @@
<?php
/**
* Standalone landing template for the page slug "test1".
*
* @package Twenty_Twenty_Four
* @since Twenty Twenty-Four 1.0
*/
$landing_file = ABSPATH . 'index3.html';
$landing_html = file_exists( $landing_file ) ? file_get_contents( $landing_file ) : false;
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>
</head>
<body <?php body_class( 'test1-landing-page' ); ?>>
<?php wp_body_open(); ?>
<?php
if ( $landing_html && preg_match( '/<body[^>]*>(.*)<\/body>/is', $landing_html, $matches ) ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $matches[1];
} else {
?>
<main class="site-main" role="main">
<div style="padding:48px 16px;max-width:1180px;margin:0 auto;">
<p>Не удалось загрузить шаблон страницы `index3.html`.</p>
</div>
</main>
<?php
}
?>
<?php wp_footer(); ?>
</body>
</html>

View File

@@ -266,10 +266,10 @@ function water_delivery_fonts_url() {
/**
* Enqueue scripts and styles.
*/
function water_delivery_scripts() {
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
$fonts_url = water_delivery_fonts_url();
$primary_color = water_delivery_get_option( 'primary_color' );
function water_delivery_scripts() {
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
$fonts_url = water_delivery_fonts_url();
$primary_color = water_delivery_get_option( 'primary_color' );
if ( ! empty( $fonts_url ) ) {
wp_enqueue_style( 'water-delivery-google-fonts', $fonts_url, array(), null );
}
@@ -297,12 +297,12 @@ function water_delivery_scripts() {
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'water_delivery_scripts' );
/**
* Enqueue editor styles for Gutenberg
*
}
add_action( 'wp_enqueue_scripts', 'water_delivery_scripts' );
/**
* Enqueue editor styles for Gutenberg
*
* @since Water Delivery 1.0.0
*/
function water_delivery_block_editor_styles() {