Skip Navigation

[Gelöst] Designing one view with „breaks“ or two views using same Query Filter

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

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 vor 4 Jahre, 2 Monate. 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 – 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)

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

Zuletzt aktualisiert von DavidW2160 vor 4 Jahre, 2 Monate.

Assistiert von: Luo Yang.

Author
Artikel
#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!

Dieses Ticket ist jetzt geschlossen. Wenn Sie ein Toolset Kunde sind und Hilfe benötigen, eröffnen Sie bitte ein neues Support-Ticket.