I am creating a custom plugin that connects to an external API and pulls in data about a company's locations. Currently, the plugin has a shortcode that I put on a "Locations" WordPress page that lists all the locations.
Essentially I'm just hitting the API, pulling back the data, generating some HTML and returning it to the short code. This works fine for the locations page (/locations), as it has the WordPress page's title and copy above the list. But for the locations detail page I need a "blank" canvas.
I tried using add_rewrite_rule() to create the detail page, and sending the additional query vars through url segments. That works, but sending the rewrite rule to the wordpress page means the page title and content still appear.
How should I architect this plugin so that I can link to a URL ie. /locations/address/id that doesn't really exist in WP, but rather just builds dynamically. We'd like this to use the "page" or "post" if possible, but trick WordPress into using our page title and content HTML.