I'm editing a functions.php
file in a child version of a WordPress theme in order to load a custom javascript filmScript.js
, which exists, but is currently empty. If I comment out line 10
wp_enqueue_scripts( 'myVideo', get_stylesheet_directory_uri() . '/assets/js/filmScript.js', array('jquery'), '1.0.0', false );
everything works: echo statements log to the console, the page loads, etc. However, when the line is being read the page breaks and throws a 500 Internal Server Error
. Here's the entire functions.php:
<?php
add_action( 'wp_enqueue_scripts', 'video_bg', 10);
add_action( 'after_setup_theme', 'post_theme_setup' );
if ( !function_exists( 'post_theme_setup' )):
function post_theme_setup(){
function video_bg() {
wp_enqueue_scripts( 'myVideo', get_stylesheet_directory_uri() . '/assets/js/filmScript.js', array('jquery'), '1.0.0', false );
echo '<script>console.log("Script added?")</script>';
}
add_action( 'wp_enqueue_scripts', 'video_bg', 10);
echo '<script>console.log("Action added")</script>';
}
endif;
Any thoughts? Thanks!