At the time functions.php is included during bootup, WordPress has no idea on the contents of the query, and doesn't know the nature of the page. is_home will return false.
Wrap the code in a function and have it triggered by the wp hook, which comes after the global query object has been hydrated with data.
add_action( 'wp', 'check_homepage' );
function check_homepage() {
if ( is_home() )
add_action( 'wp_enqueue_scripts', 'my_scripts' );
}
Wrap the code in a function and have it triggered by the wp hook, which comes after the global query object has been hydrated with data.
add_action( 'wp', 'check_homepage' );
function check_homepage() {
if ( is_home() )
add_action( 'wp_enqueue_scripts', 'my_scripts' );
}
is_home() is not working in functions.php
At the time functions.php is included during bootup, WordPress has no idea on the contents of the query, and doesn't know the nature of...