правки test1

This commit is contained in:
2026-04-05 20:13:07 +03:00
parent f97e239274
commit 5f4c2e91ac
4 changed files with 200 additions and 3 deletions

View File

@@ -228,6 +228,29 @@ function twentytwentyfour_test1_template( $template ) {
}
add_filter( 'template_include', 'twentytwentyfour_test1_template' );
/**
* Use a standalone PHP template for the page slug "faq".
*
* @since Twenty Twenty-Four 1.0
*
* @param string $template Resolved template path.
* @return string
*/
function twentytwentyfour_faq_template( $template ) {
if ( ! is_page( 'faq' ) ) {
return $template;
}
$custom_template = get_theme_file_path( 'page-faq.php' );
if ( file_exists( $custom_template ) ) {
return $custom_template;
}
return $template;
}
add_filter( 'template_include', 'twentytwentyfour_faq_template' );
/**
* Use a lightweight custom template for the WooCommerce checkout page.
*
@@ -281,7 +304,7 @@ add_filter( 'template_include', 'twentytwentyfour_cart_template', 20 );
* @return void
*/
function twentytwentyfour_test1_assets() {
$use_test1_assets = is_page( 'test1' );
$use_test1_assets = is_page( array( 'test1', 'faq' ) );
if ( ! $use_test1_assets ) {
return;
@@ -290,7 +313,7 @@ function twentytwentyfour_test1_assets() {
$css_file = ABSPATH . 'index3.css';
$js_file = ABSPATH . 'index3.js';
if ( is_page( 'test1' ) ) {
if ( $use_test1_assets ) {
wp_dequeue_style( 'global-styles' );
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
@@ -335,6 +358,20 @@ function twentytwentyfour_test1_assets() {
}
}
if ( is_page( 'faq' ) ) {
$faq_js_file = get_theme_file_path( 'assets/js/test1-faq.js' );
if ( file_exists( $faq_js_file ) ) {
wp_enqueue_script(
'twentytwentyfour-test1-faq-script',
get_theme_file_uri( 'assets/js/test1-faq.js' ),
array(),
(string) filemtime( $faq_js_file ),
true
);
}
}
}
add_action( 'wp_enqueue_scripts', 'twentytwentyfour_test1_assets', 100 );
@@ -345,7 +382,7 @@ add_action( 'wp_enqueue_scripts', 'twentytwentyfour_test1_assets', 100 );
* @return void
*/
function twentytwentyfour_test1_shared_shell_assets() {
if ( ! ( ( function_exists( 'is_checkout' ) && is_checkout() && ! is_order_received_page() ) || ( function_exists( 'is_cart' ) && is_cart() ) ) ) {
if ( ! ( ( function_exists( 'is_checkout' ) && is_checkout() && ! is_order_received_page() ) || ( function_exists( 'is_cart' ) && is_cart() ) || is_page( 'faq' ) ) ) {
return;
}