Saltar navegación

[Resuelto] Browse through found entries of a filter search

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem: I would like to be able to browse search results one post at a time, and have navigation that links through the results one by one.

Solution: Use a taxonomy archive with custom search fields.

Relevant Documentation:
https://toolset.com/documentation/getting-started-with-toolset/customize-post-archives/

This support ticket is created hace 6 años, 4 meses. 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)

Este tema contiene 8 respuestas, tiene 2 mensajes.

Última actualización por tobiasF-3 hace 6 años, 4 meses.

Asistido por: Christian Cox.

Autor
Mensajes
#1086595

I have setup a filter search which allows me to filter through my database of dogs. For example, I can filter the database so it only shows male dogs:
enlace oculto

When I click on a dog is takes me to the custom layout for my custom post type 'dogs' which shows the single entry of a dog. On that custom page on the top left in pink, I use the wpv-post-next-link and wpv-post-previous-link to browse through the single dog entries:
enlace oculto

But when I browse through the links with these links, it browses through the full database. But when I have filtered my search to only show male dogs in the view page, I would also like to restrict the browsing to male dogs in the single entries. How can I do this?

I've used the official toolset docs to setup the filter search and layouts but did not find any info on this.

Many websites allow you to search for entries and then browse only through the found set.

What is the link to your site?
enlace oculto

#1087117

Hi, there's not an easy way to do this in WordPress when you direct Users to the single post page from each result, like enlace oculto. When visiting a single Dog post at this URL, Views has no reference to the search results from the View you were interacting with before. This means Views has no way to determine what the next and previous posts should be in context. You might be able to accomplish what you're looking for using custom code, but it's not something I can provide here as a simple cut-and-paste solution. It will require a skilled developer. We have a portal available where you can connect with independent contractors: https://toolset.com/contractors

On the other hand, if the similar posts share a common taxonomy term, then you could use WordPress Archives to achieve something similar without the need for custom code. WordPress automatically generates taxonomy term archives at specific URLs. So if the taxonomy name is "gender" and the term is "female", then WordPress will generate an archive of female dogs at yoursite.com/gender/female. You can use Toolset's WordPress Archives feature to design this page, and include next and previous post links in the template. Let me know if you have questions about that.

#1087132

Hey Chris, I was fearing you would say something like that 🙂 But the taxonomy idea sounds like a great plan.

But will it be possible to show also combined search results from the filter query? So if I search for female dogs that have size big?

If yes: could you give me an example how I would have to set this up?

Thank you very much for your great and very detailed support. You guys are doing a tremendous job.
Tobi

#1087491

To combine taxonomy archives with custom field filters, you will create a WordPress Archive and add custom search filters. Then your site visitors can choose "Big" or "Spayed" etc. There are some limitations to this approach:
1. You cannot split the search form and search results into separate pages easily. Your visitors must use the search form on this archive page.
2. On the /gender/female archive, you cannot filter by Gender: Male. In other words, you cannot filter a taxonomy archive by that same taxonomy.

https://toolset.com/documentation/user-guides/normal-vs-archive-views/

#1087552

Thx Chris, so in the WordPress Archive I could browse only through the filtered single entries like 'big'? Sorry, I still struggle to see the difference...

Also: how can I filter a view by several elements of the same select field? So for example: if I want to show entries of a select field with seven elements and I would like to filter by two elements of the seven? For some reason toolset does not let me chooses the same field twice to filter by several elements in that field? What am I not getting? thx for your support!
T

#1087599

Thx Chris, so in the WordPress Archive I could browse only through the filtered single entries like 'big'? Sorry, I still struggle to see the difference...
In any approach, as soon as you send Users to the single post URL enlace oculto, the search results reference is lost and it is no longer possible to browse among search results. I don't have a solution available that will solve that problem for you. However, you can use a custom search View or a WordPress Archive with custom search filters to display a paginated list of results. If you show only one item per page, then you can paginate from one matching post to the next. However, the page URLs will not be the single post URLs. They will be paginated View or Archive URLs. I have set up a demo site here at discover-wp.com so you can see what I'm talking about.
https://christiancox-22119-gswt-1.discover-wp.com/gender/female/
This is a taxonomy archive that includes a custom field filter for "size". Select "Small". You will see that there is a list of paginated results. You can browse back and forth between the results. You can include any information about the dog post here in the paginated result. However, as soon as you click one of the results and go to the single post URL, the reference to the search results is broken and browsing is no longer possible.

#1087603

Great, thx for elabourating, yeah I think that could be a nice workaround. So I create a few direct links to the most common filter selections and and then create a custom search view with more detailed filters. And in that single paginated view, I will include most of the info on the single page and not provide a single page link. I'll try that out, thx.

One other quesion: how can I filter a view by several elements of the same select field? So for example: if I want to show entries of a select field with seven elements and I would like to filter by two elements of the seven? For some reason toolset does not let me chooses the same field twice to filter by several elements in that field? What am I not getting? thx for your support!

#1087614
Screen Shot 2018-08-20 at 1.37.44 PM.png

I believe you can accomplish that by choosing the "in" operator instead of "equal to" in the Query Filter settings. This will allow you to test for any of several values.
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

#1097433

Thank you so much, works great!