Enqueue JavaScript files

The related post component we’re building will use JavaScript to query the WordPress Rest API, then output the results when the users scroll down to that section. 

(In the exercise files for this movie, look for the “related.js” file under assets/js/src. This will eventually become the full JavaScript we’re going to use.)

In this video, our goal is to get this file enqueued *only* on single posts, so that we can actually see these results. Once the file is enqueued, we’ll be sending requests, and getting responses through the WordPress REST API.

More from this course: