What’s the best way to have custom CSS that only loads on the front page? is there a good article for this? I am kind of struggling finding an article that shows me how to do this… But I am not entirely sure whats the best way
You can use conditional tag in your action callback. For example:
add_action('wp_enqueue_scripts', function () {
...
if (is_home()) {
wp_enqueue_script('home-script');
}
});
1 Like
This topic was automatically closed after 42 days. New replies are no longer allowed.