Skip Navigation

[Resolved] Filtered view for different pages

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 6 replies, has 2 voices.

Last updated by Minesh 10 months ago.

Assisted by: Minesh.

Author
Posts
#2679403

Hi, I am trying to use the same view for different pages with different filter methods.

For example, I have a rental website and listing from different cities in France. I already have a view created to list all my items including from Paris, Lyon etc. However, I would like to create a different page for each city (let's say Paris) to show relevant view items from that particular city which is Paris.

Do I need to create the same view repeatedly for each city? Or is there a way that I can filter for each page to do this with only one view and tell which page to show on?

Thanks a lot!

#2679457

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You can create a view to filter by your custom city filed using the shortcode attribute that way you can use a single view form multiple cities.

For that you will have to use the legacy view and if you are using blocks plugin, you can enable the legacy view by following the steps given with the following link:
- https://toolset.com/course-lesson/enabling-legacy-version-of-toolset-views/

For example:

[wpv-view name="your-view" city="Paris"]
[wpv-view name="your-view" city="Lyon"]

More info:
- https://toolset.com/documentation/legacy-features/views-plugin/passing-arguments-to-views/#controlling-the-filter-with-shortcode-attributes

#2679568

Thanks for your prompt answer and I follow your steps. The legacy mode is activated.

I tried to use a short code and I got the visualization of the view. But my cities are taxonomy and I couldn't filter them out in the view to be able to filter only certain cities.

These are the shortcodes that I tried:

[wpv-view name="homestay list canada" category="Toronto"]
[wpv-view name="homestay list canada" City-in-Canada="Toronto"]

I also checked the following articles but the problem is not solved yet.

https://toolset.com/documentation/legacy-features/views-plugin/passing-arguments-to-views/#controlling-the-filter-with-shortcode-attributes

#2679573

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please share problem URL where you are trying to display your view as well as admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2679611

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As you can see with the following view:
- hidden link

I've added the query filter for your taxonomy under the "Query Filter" section:

Taxonomy filter
Select posts with taxonomy:
Cities in Canada slug in one of those set by the View shortcode attribute wpvcitycanada
eg. [wpv-view name="view-name" wpvcitycanada="xxxx"]

You can add whatever content you want to display inside the "Loop Editor" section.

And you can call the above view for different cityes as given under where you will have to pass the term slug:

[wpv-view name="view-name" wpvcitycanada="toronto"]

[wpv-view name="view-name" wpvcitycanada="vancouver"]
#2679765
Screenshot 2024-01-24 at 12.13.46 AM.png

Unfortunately, this didn't work as you can see on the screenshot.

The loop result shows all cities still.

#2679784

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I see you are not using the term slug:

You should pass the term slug to "wpvcitycanada" shortcode attribute.

- Toronto
[wpv-view name="homestay-in-toronto" wpvcitycanada="toronto"]

- VanCover
[wpv-view name="homestay-in-toronto" wpvcitycanada="vancouver"]

Which I already mentioned with my previous reply:
- https://toolset.com/forums/topic/filtered-view-for-different-pages/#post-2679611

Can you please use the above shortcode and try to resolve your issue.