I have pages with a custom meta field called “ctr_state”, and it contains a state name, like “Arizona”.
I am trying to construct a hyperlink that will return an archive-like list of pages that match the meta_value I am looking for.
For instance,
<a href="http://mydomain.com/?type=page&meta_key=ctr_state&meta_value=Arizona">Show All Arizona Pages</a>
This isn’t working, but is just to show how I want it to work as a link. I don’t want a list on the page, I just want it to link to an archive type page, showing just the page’s that match the state I’m looking for.
Is this possible?
This is how I got it working:
ADDED this to functions.php:
ADDED THIS to header.php because WP thinks it’s serving a 404 page
ADDED THIS to the base template (page.php):
CREATED state.php template that handles state queries: