How to load a css file in one page only?

You should be doing JS and CSS loading with wp_enequeue_script and wp_enqueue_style. Register the script at the init hook (or later) and then enquque it at the wp_print_scripts hook. Using this, you can say something like if( is_page( 42 ) ) : wp_enqueue_script( 'my_script' ); endif; and just call it a day.

Additional Functions: wp_register_script(), wp_register_style

Leave a Comment