Skip Navigation

[Resolved] Using the WP views filter widget on multiple pages

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a custom search View and I would like to display the filters only in a widget on my site. I would like to display the results on the same page, but the WP Views Filter widget does not allow me to set the destination of the results like this.

Solution: Use a custom HTML widget instead with the wpv-form-view shortcode:

[wpv-form-view name="your-view-slug-or-name" target_id="self"]

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-form-view

This support ticket is created 3 years, 10 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by nathanB-3 3 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#2000681

As you can see here, I have added the WP views filter widget on this page: hidden link

My problem is that I want to display this widget in 8,000 cities across the U.S. and I need to manually enter the city in each widget. Currently, the widget redirects search results for all other cities to New York, for example, hidden link returns search results for New York.

I would like to use the current URL as the "Target page to show the results". Is there a workaround or do I need to implement custom code?

Thank you, Nathan

#2000719

Hello, in your case I would use a different widget. I would use a Custom HTML widget instead of the WP Views Filter widget, and insert the custom search View in the widget contents using a shortcode like this:

[wpv-form-view name="your-view-slug-or-name" target_id="self"]

Replace your-view-slug-or-name with the slug or title of the custom search View. This shortcode will display the search filters, and will also display the results of the search on the same page when you submit the search form, assuming you have inserted the View in the template applied to the current page. It is best to use the Custom Search option "Full page refresh when visitors click on the search button" in this View.

Let me know if you have questions about this.

#2000957

Thank you very much,
I didn't know about this shortcode.
My issue is resolved now. Thank you!