You might have faced a situation when you are trying to is_home() inside functions.php but it is not working.
If you will use ‘init’ hook then is_home() will not work inside the functions.php . For using is_home() you will need to use ‘wp’ hook. Check the example below.
add_action( 'wp', 'check_home_condition' );
function check_home_condition() {
if ( is_home() )
add_action( 'wp_enqueue_scripts', 'add_my_scripts' );
}
function add_my_scripts() {
...
}
(Visited 577 times, 1 visits today)





