I have an external database and I want to serve data to pages from the database.
A similar example would be location data within this database. Imagine 500 locations. We want to be able to either serve a location from a WordPress page or if the page doesn’t exist in WordPress serve out a template and client side in the page inject the appropriate JSON data in the page. We have it setup to inject the json data via client-side script.
Below is an example:
/locations/north-america/united-states/colorado/denver/ – if this page exists then there is likely custom content on the page and we want to serve out the page and insert the json data in the browser
Another Example:
/locations/north-america/united-states/colorado/colorado-springs/ – If this page doesn’t exist we want to treat it like a virtual page and generate the page from a template.
It’s important to note that SEO is important. I’ve been researching rewrite rules and permastruct. I’m not 100% sure that I know the direction to go and how to accomplish with a customization.
Another note:
The following pages may not exist, but we want to dynamically create them from different templates (the first using a country template and the second a city template):
/locations/north-america/canada
Or
/locations/north-america/canada/banff
We’ve tried investigating permastrcutres and rewrite rules. Not exactly the best approach to take.