Skip Navigation

[Resolved] Filtering by url parameter doesn´t work

This support ticket is created 5 years, 9 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by hannesU-2 5 years, 9 months ago.

Assisted by: Beda.

Author
Posts
#920806

I am trying to:
Filter custom post type (filme) by post fields and taxonomy.
So i have my CPT filme (movies) containing psot fields genre, duration etc.)
And i have one CPT "festivals-einzel" (filmfestivals in different years)
I try to create a page where you can see movies of one festival sorted by the days of the festival.
I therefore use two nested views:

1. the first view "view-programmuebersicht-automatisch" filters for "festivals-einzel" and returns the dates of that festival in the loop. I therefore create an url parameter to call the cpf Festival Jahr and filter the dates for that festival.
In this loop i have a view nested that is containing the shortcode ausstrahlungstag='festival-tag-1', the next day in that loop calls the same view with the shortcode 'festival-tag-2',...

2. the nested view 'auflistung-der-filme-eines-tages' is than supposed to list all movies of that specific day by filtering the shorcode 'festival-tag-1', festival-tag-2,.....
To show only the movies of the relating festival i am filtering for taxonomies shortcode. But this doesnt work.

When i add the shortcode wpvfestival='festival-2017' additionaly to the shortcode ausstrahlungstag='festival-tag-1' in the first view, where i call the nested view, everything works fine. But i would like to get the content of the variable wpvfestival by url parameter (for example linktothepage/?jahr=2017&wpvfestival=festival-2017) and instert this url parameter as shortcode when calling the nested view.

Link to a page where the issue can be seen:
hidden link

I expected to see:
see above
Instead, I got:
movies from the festivals from all years, not just the one i want to show on that page.

First i tried to solve all this by using post relationships, but that didnt work.

Hope this is all not too confusing...

Best regards
Hannes

#921081

Do you mean to use the URL parameter (which is dynamic) to populate the View's ShortCode?

You can try the Toolset ShortCode wpv-search-term:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term

This allows you to output the URL parameter value which you listen to.

Please let me know if that is not what you intended.

I also Speck German, in case this helps you to explain the issue.

#921189

Hallo Beda,
danke für die schnelle Antwort.
Ich habe wpv-search-term jetzt mal benutzt um zu kontrollieren, ob der parameter richtig übergeben wird.

Im Link übergebe ich zwei Parameter:
/programmuebersicht-2017/?jahr=2017&wpvfestival=festival-2017

Und im view filtere ich nach
Beiträge mit Taxonomie auswählen:
Festivals Slug in einer von diesen, die vom View-Short-Code-Attribute festgelegt werden: wpvfestival
eg. [wpv-view name="view-name" wpvfestival="xxxx"]
UND
Festival Tage Slug in einer von diesen, die vom View-Short-Code-Attribute festgelegt werden: ausstrahlungstag
eg. [wpv-view name="view-name" ausstrahlungstag="xxxx"]

Festival Tage und Festivals sind beides Kategorien.
Die Festival Tage werden richtig gefiltert.
Die Festivals werden nicht gefiltert. Heisst also, dass mir der view auch die Filme vom Fetsival 2015 (slug=festival-2015) ausgibt.

#921548

Ja, aber wo hast du wpv-search-term eingesetzt?

So wie Ich das sehe, hs Du ein Link irgendwo auf der Seite, und dieser Link hat URL parameters, die dann in Einer View gebraucht werden um die Resultate zu verfeinern.

In deinem falle, gibst Du die werte nicht per URL parameter an die View, aber mit ShortCode parameter.
Also wenn der ShortCode parameter den URL parameter den Du von dem Link hast übernehmen soll, dann müsstest Du so wie unten dargelegt vorgehen, wenn Du die View mit ShortCode parameters irgendwo auf der Seite einsetzt.

1. URL: /programmuebersicht-2017/?jahr=2017&wpvfestival=festival-2017
2. Möglicher Einsatz:
[wpv-view name="view-name" wpvfestival="xxxx"]
[wpv-view name="view-name" ausstrahlungstag="xxxx"]
3. Einsatz mit wpv-search-term:
[wpv-view name="view-name" ausstrahlungstag="[wpv-search-term param='jahr']" wpvfestival="[wpv-search-term param='wpvfestival']"]

Dies wird nun deiner View die exakten values von ?jahr und &wpvfestival= weitergeben, in die ShortCode Attributes ausstrahlungstag und wpvfestival

Soweit, die Theorie.

#921603

Guten Morgen.
Vielen Dank, Beda! Durch Deine Antwort bin ich darauf gekommen, dass ich anscheinend irgendwann beim rumprobieren die Kategorie Festival nicht mehr als url para sondern als shortcode übergeben habe und dann funktioniert natürlich das Filtern nicht richtig.
Jetzt läuft glaube ich alles so wie es soll.
Danke und schon mal ein schönes Wochenende
Hannes

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.