How to use wp_enqueue_style() and wp_enqueue_script() only when needed?
I have not tested it, but could is_main_query() (appeared in 3.3) be used here to test that the query being run is the query used to populate ‘the Loop’. (I’m not sure how it handles new WP_Query instances, though). The Codex says that it can be used on the pre_get_posts, but looking at the code … Read more