http://localhost/asif_wp/wp-content/themes/twentytwentyfive/patterns/asif.php?id=Send me): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in C:\xampp\htdocs\asif_wp\wp-content\themes\twentytwentyfive\functions.php on line 168
Этот код работает нормально: [code] function register_custom_patterns() { $vari = 5; register_block_pattern( 'twentytwentyfive/asif', // The pattern slug array( 'title' => __( 'Test Pattern', 'twentytwentyfive' ), 'description' => __( 'A custom test pattern for the theme.', 'twentytwentyfive' ), 'content' => file_get_contents( get_template_directory_uri() . '/patterns/asif.php?id='. $vari), // Path to your custom PHP file ) ); } add_action( 'init', 'register_custom_patterns' ); [/code] Но это не работает: [code]function register_custom_patterns() { $vari = "Send me"; register_block_pattern( 'twentytwentyfive/asif', // The pattern slug array( 'title' => __( 'Test Pattern', 'twentytwentyfive' ), 'description' => __( 'A custom test pattern for the theme.', 'twentytwentyfive' ), 'content' => file_get_contents( get_template_directory_uri() . '/patterns/asif.php?id='. $vari), // Path to your custom PHP file ) ); } add_action( 'init', 'register_custom_patterns' ); [/code] Ошибка: [code]http://localhost/asif_wp/wp-content/themes/twentytwentyfive/patterns/asif.php?id=Send me): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in C:\xampp\htdocs\asif_wp\wp-content\themes\twentytwentyfive\functions.php on line 168 [/code] Коротко: Параметр [code] $vari = 5; // Working $vari = "Show me"; //Error [/code] Почему и как это решить?