Closing PHP tag and then opening in the next line:
Whenever there is something (even space, tab, newline etc.) after a closing PHP tag ?>
or before an opening PHP tag <?php
, PHP engine considers it as output.
So the way your code is, it’ll generate some unnecessary output, that often throws error or warning like:
Header already sent …
So you must make sure there is no unintended output, even if you need multiple opening and closing PHP tags.
Closing PHP Tag ?>
PHP doesn’t need the closing PHP tag ?>
.
If the file ends while within the scope of any opening PHP tag <?php
, PHP considers the file ending to be the end of the PHP tag.
CODE fix:
So in that light, your CODE will be like:
<?php
add_action( 'wp_enqueue_scripts', 'sydney_child_enqueue_styles' );
function sydney_child_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED - Do not modify or remove comment markers above or below:
// END ENQUEUE PARENT ACTION
add_action('woocommerce_before_checkout_form', 'add_content_above_checkout', 15);
function add_content_above_checkout () { echo 'TEST'; }