Skip Navigation

[Resuelto] Designing one view with «breaks» or two views using same Query Filter

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

Problem:

How can two views, both on the same page, both use the same query filter with same URL parameter?

Solution:

Yes, it is possible to pass same URL parameter to both views, and take effect on both of them, you can disable AJAX search, for example:

Edit both post views:

1) in section "Custom Search Settings", enable option: Full page refresh when visitors click on the search button,

2) In section "Search and Pagination", add a submit button

Relevant Documentation:

This support ticket is created hace 3 años, 8 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.

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

Etiquetado: ,

This topic contains 5 respuestas, has 2 mensajes.

Last updated by DavidW2160 hace 3 años, 8 meses.

Assisted by: Luo Yang.

Autor
Mensajes
#1722229

I have a custom post type with two categories -- "premium" and "basic". I want to display premium posts first, then basic posts. There are two logical ways to do this:
1) Sort on category descending ... When the first premium post is detected: print "Premium", then display the "Premium' posts; then, when the first basic post is detected: print "Basic" and then display the "Basic" posts
2) Using two views, one for Premium and one for Basic. Display the Query filter for the Premium view, but use the same query for the Basic view -- that is, the basic view would display only the search results. Other than selecting on category, the views are currently identical.
How?

#1722257

Using 2 views (#2 in my original post)
It might be helpful to know the URL of the search string. I have one Premium post with a value of "Eugene" and one Basic post with a value of "Cottage Grove".

This query string, output from the Premium view, shows both Premium and Basic posts -- that is, it doesn't filter the Basic view at all
?wpv_post_search=Eugene&wpv_aux_current_post_id=222&wpv_aux_parent_post_id=222&wpv_view_count=565

This query string shows just the Premium post, as it should:
?wpv_post_search=Eugene

This query string shows just the Basic post, as it should:
?wpv_post_search=Cottage

The abbreviated query string is what I want, since the rest of it mucks up the results. Is there any way to suppress everything after the search criteria? (i.e. suppress this: &wpv_aux_current_post_id=222&wpv_aux_parent_post_id=222&wpv_view_count=565) I don't even understand what the rest of the query string is supposed to do.

#1722509

Hello,

In your case, I suggest try the Using 2 views (#2 in your original post).

There isn't such kind of built-in feature to suppress those URL parameters, they are required for Views ajax pagination/search features.

In your case, the URL parameter "wpv_aux_current_post_id" and "wpv_aux_parent_post_id" should be current page ID.
"wpv_view_count" should be view's ID

#1727495

I may not have been clear -- I have two queries on one page, and want the query filter to be used by both views. In a nutshell, my question is really this: how can two views, both on the same page, both use the same query filter?

#1727851

Yes, it is possible to pass same URL parameter to both views, and take effect on both of them, you can disable AJAX search, for example:
Edit both post views:
1) in section "Custom Search Settings", enable option: Full page refresh when visitors click on the search button,
2) In section "Search and Pagination", add a submit button

Then test again

#1728409

My issue is resolved now. Thank you!

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