Skip Navigation

[Résolu] Custom archive pages for one CPT

This support ticket is created Il y a 7 années et 10 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 réponse, has 1 voix.

Last updated by scottD-2 Il y a 7 années et 10 mois.


I have set up a CPT to populate information on golf courses. Each golf course has several custom fields, including address, city, phone, website URL, etc. I want to create an archive page for each city and have it display only results of golf courses that are in that particular city. The archive pages should all look identical with the exception of the courses listed on that page, so I don't want to create 30+ archive pages in Views with identical CSS formatting, etc.
Is there a way to create one archive page that can be used with a filter of some sort to only show the appropriate results?
As clarification, I want to be able to link to these pages like hidden link, which would display all the courses in Phoenix, or hidden link, which would show all the courses in Scottsdale. It should be similar to how a regular blog post Category archive page works.


I think I solved my own problem. I didn't make the connection to my problem before when reading this article

Basically I created a new View and called it Golf Courses. This is where I'm formatting the display of the page. In the Query Filter section, I added a custom field filter for wpcf-city

= | CHAR | Shortcode attribute | location 

Then I created a regular WP page for each city and included the following shortcode:

[wpv-view name="golf-courses" location="Phoenix"]

In the shortcode, I changed the location attribute to the appropriate city name.

This seems to work fine for my purposes, but I am open to suggestions if there is a better way to do it. The nice part about this way of doing it is that I can add some custom text on each city page for SEO purposes.