I guess I am done with it. Please see hidden link - this demo page shows 2 listings:
1) All Cities -> List Cities and the listings falling under those cities
=> Uses 2 views; one for Cities, while other for Listings. The later view is based on an Intermediary Object "City-Listings-xref" (xref = cross reference, I used this term to point out the intermediary objects).
2) All City Groups -> Listings Grouped by City Groups -> City -> Listing
=> Uses 3 views; one for City Groups, second (child) for Cities (uses intermediate object), while 3rd (child of second) for Listings (uses intermediate object)
Please note, each child view has a filter on it, either for Parent Relation or for Child Relation. I have used 3 Intermediate Objects to cross reference 3 CPTs:
OK. Here's what I've been able to do, using your demo (thank you SO much!).
Don't laugh at the design. That's not what I'm concerned with, at the moment. 😉
San Angelo, Texas hidden link
San Angelo has 2 business listings tied directly to it. Angelo PC also serves cities nearby. The dummy listing only serves (chose/paid to be listed only in) San Angelo.
Christoval, Texas hidden link
Christoval is a city near San Angelo. Angelo PC serves (chose/paid to be listed, additionally, in) Christoval.
Fort Washington, Maryland hidden link
Fort Washington doesn't have any listings and doesn't display any that shouldn't be there.
Computer repair in cities near Christoval, Texas
<<img>> Angelo PC Angelo PC – San Angelo <--- right over there
Using what I currently have, is it possible to link the text that says "San Angelo", to the actual City page?
UPDATE: I was able to link "San Angelo" to the City page, but in a really cruddy way.
UPDATE: Uhh...never mind. I'm dumb, in biblical proportions. I figured it out.
One thing I've noticed is that, when you go to edit a listing or a city (and maybe even a state), the editor takes FOREVER to load (and to load after updating). I think it's because each of those CPTs is tied to many other things and the lists for each city and state must be loaded, multiple times, in the editor page.
This may be the only solution, for what I want to do, but I don't know that it's the optimal solution.
Thank you for your feedback. Please consider followings regarding your recent questions:
1) is it possible to link the text that says "San Angelo", to the actual City page?
Yes, that's possible, but since all posts are under CPTs (without any categories), you won't be able to create an archive (real WP archive). But of course, you can create such a view where you can list Cities and make it looks like (design) an archive. All you will need to pass parameters (URL and/or Short Code Attribute), so your view can query (filter) the results accordingly. Intermediate objects are a great way to join the posts from different post types (having no relation infact). You can create more intermediate objects (if required). But in this very case, I think a view querying for cities and filtering based on a URL parameter would be sufficient (i.e. /cities?id=123 or /cities?name=san-angelo). And you can link to this page from wherever you want.
2) Yes of course it will slow down the thing overall. Because these are not real relationships, but are artificial joins. These are not indexed, specially if your filters are based on text-search (i.e. city name, custom field and etc). Although Views plugin has been improved for caching, but this is still a work-in-progress. And we are expecting a more reliable caching feature for Views, in the near future, which will allow the Views to return the results much faster. For now, you can try out the latest betas however, but remember to take backup of your current system before upgrade.
The other day, when you mentioned using taxonomies, were you suggesting that a single listing could be tagged for multiple locations or were you talking about something more ""global"?
If I were to tag a listing with "San Angelo, Texas TX" (matches the actual City name [and slug], exactly) and tag surrounding Cities, with the same tag, could I then use a filter to display listings with tags that match that tagged City, in Cities other than the original (main) City?
I think this might be a more optimal solution than the "link" CTPs.
As a side note, Custom Taxonomies in Types offer 2 kinds of terms - Flat and Hierarchical. Both are same in terms of a taxonomy, but with a major difference:
- Flat = Can not have child terms (WP Tags are an example of this)
- Hierarchical = Can have children and grand-children (like Categories and provide more flexibility in such situations).
Using hierarchical is recommended in your case. Since these reduce data-entry efforts also. These are listed in form of a tree of checkboxes on post edit screen. While, flat taxonomies are presented as a text box, you will have to type the term and will have to select from suggested-tags (previously created). This can confuse you while attaching terms to a post or might lead to multiple-typo-errors for the same thing.