Your issue is likely with your PHP opening and closing tags (these things: <?php
, ?>
. If you have an open PHP tag, <?php
, and then try to add another one, you will cause a fatal error.
It’s important with your PHP files to keep track of your PHP tags so that they’re balanced, just like HTML tags need to be. For a standard functions.php file you likely only need a single PHP tag at the very beginning (you shouldn’t use a closing PHP tag if it’s the end of the file):
<?php
function wpb_custom_new_menu() {
register_nav_menu('my-custom-menu',__( 'My Custom Menu' ));
}
add_action( 'init', 'wpb_custom_new_menu' );
function wpb_theme_supports() {
add_theme_support('post-thumbnails');
}
add_action( 'after_setup_theme', 'wpb_theme_supports' );
Note that add_theme_support()
needs to be within a function that’s hooked on after_setup_theme
. Also, don’t put HTML comments in your functions file like that. It will always be output and will likely cause headers related errors.