One of the standard components for our WordPress themes, this has been built up over the years to become a plugin of sorts. It is used to load arbitrary WordPress page or post content into a Bootstrap 5 modal, on the fly.
I like to use it to load the Privacy Policy page content. It doesn’t replace the Privacy Policy single page view, so that page template still needs to look nice, but as a quick solution, it works well.
I am still working on educating clients and coworkers what modals are exactly, and when and where to use them. The struggle is real.
This is vanilla JavaScript; it does not require jQuery. It does require the modal component of Bootstrap 5, and some very specific markup and a few other components. It will use the REST API of WordPress to retrieve the page content, falling back on the regular URL if REST fails.