Skip Navigation

[Gelöst] Add header to search results with name of taxonomy and number of results

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:

The issue here is that the user wanted to get the searched term from the URL.

Solution:

We actually have a shortcode for this
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term

This should be able to resolve the issue.

This support ticket is created vor 6 Jahren, 9 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Dieses Thema enthält 3 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Shane vor 6 Jahren, 9 Monaten.

Assistiert von: Shane.

Author
Artikel
#622967

I searched your support extensively but cannot find a solution to this:

I have a parametric search results page that is working well but I need to add a header that displays something like this:

"Showing jobs in Maine, Home Health Aide (5 results)"

I am able to display the number of results before the loop using the [wpv-items-count]

How can I display the custom taxonomy of the State and the custom taxonomy of the job title?

#623007

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Jason,

Thank you for contacting our support forum.

You should be able to achieve this with the following shortcode.
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term

Its able to get what you searched for in the url and all you need to do is let the shortcode know which URL parameter it should get the searched value for.

Please let me know if this helps.
Thanks,
Shane

#623234

Thank you! That worked great. I do have one more question now that I have the Custom Taxonomy being pulled from the URL parameter.

When all results are being displayed for a certain taxonomy, the URL parameter looks like this:

?wpv-profession-type=0

How can I make that 0 instead be:

?wpv-profession-type=all-professions

So that the search header would say

"Showing Results for All Professions"

#623347

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Jason,

Unfortunately with these you will need to write some custom shortcode to get the information.

For the Taxonomy you should be able to get the taxonomy term name by writing a custom code using the slug to get the name however with the custom field value of 0, it would be possible.

Please let me know if this helps.
Thanks,
Shane