Find answers, ask questions, and connect with our
community around the world.

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?

    updated 3 years, 4 months ago 0 Member · 1 Post
  • Deborah

    Member
    September 10, 2019 at 8:17 am

    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 – –

Viewing 1 of 1 replies
Reply to: Deborah
Your information:

Cancel
Original Post
0 of 0 posts June 2018
Now