The Underscore.js library has been in WordPress for many versions now. However, it’s next to impossible to find good tutorials that walk you through the process of utilizing it, step-by-step. I got my first taste of it when building templates for the WordPress customizer, but that’s just outputting data in a template. That’s the easy part and not much different from HTML + PHP. I had no idea how to send the data to the template. It was tough to find information on how to get from Point A to Point B. I don’t have a strong JavaScript background, so I felt completely lost trying to grok some of these concepts. But, getting the basics down isn’t all that hard once you have that “light-bulb moment” or have someone explain it to you like an actual beginner. It took me about two days to start getting comfortable working with Underscore. In this tutorial, I want to share some basics to getting things set up and running if you want to build custom Underscore templates. If nothing else, maybe it’ll help someone that’s stuck in the early learning stages of utilizing Underscore templates. Setting up the example For the purposes of the tutorial, I’m just going to make the assumption that you’re
Share This