Forums › Forums › Web Design › WordPress › Should html views with file scoped css also be enqueued?
-
Should html views with file scoped css also be enqueued?
-
Recently I learned that I should be using wordpress’s register and enqueue functions instead of requiring files with tags. Is the same for html views? One such view i have is for a coupon overlay. I currently require it like so: function countVisitsAndRenderCouponIfQualified() { $check = qualifyThisVisit(); if ($check === true) { require_once(‘views/coupon.php’); // this file has html and css using a tag } } add_action(‘wp_footer’, ‘countVisitsAndRenderCouponIfQualified’); The css in the case above is file scoped; I believe for theme files I should be enqueueing it like a .js file. Curious how you guys would handle this as a best practice. – by hq overview javascript_dev – –