Skip Navigation

[Resuelto] How to get the same Search functionality as used on wp-types.com

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.

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
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)

This topic contains 1 respuesta, has 2 mensajes.

Last updated by Christian Cox hace 6 años, 4 meses.

Assisted by: Christian Cox.

Autor
Mensajes
#587747
Screen Shot 2017-11-08 at 11.19.53 AM.png

Tell us what you are trying to do?
I would like to know how you got the functionality on the Toolset Support page for the Search bar to give it the ability to "Search Support Forum, Errata and FAQ to get help instantly"?

Is there a similar example that we can see? Yes, on the Toolset Professional Support page where one enters a search term and the results end up like the screenshot attached.

This will be for a new site.

#587804

There are a few things going on here that make this page special, in my opinion:
1. Two different sets of results, one for post type A and another for post type B.
2. The results are empty until a search term is entered.
3. The results update without reloading the page.
You can use a combination of multiple Views to achieve something similar with a URL parameter in the search bar, but #3 would require custom code that is beyond the scope of the support we provide here in the forums. You must trigger a full page load to update the results correctly.

- Create a custom search View of post type A. Include a text search filter and submit button in the Filter Controls, and use the Loop Output area to build your design for displaying post type A. Remove "No items found" from the no items found loop text. Do not use AJAX to update the results.

- Create a custom search View of post type B. Include a text search filter and submit button in the Filter Controls, and use the Loop Output area to build your design for displaying post type B. Remove "No items found" from the no items found loop text. Do not use AJAX to update the results.

- Insert the View for post type A in a page, including both the search form and results. Then insert the View for post type B immediately after that View, but include only the results.

- Now both Views will respond to the same URL parameter text searches, and will update simultaneously to show relevant results.

- If you want to show no results until someone enters a search term, you can add a bit of custom code using wpv_filter_query:

add_filter( 'wpv_filter_query_post_process', 'drop_empty_textsearch_query', 10, 3 );
function drop_empty_textsearch_query( $query, $view_settings, $view_id ) {
    if ( !isset($_GET['wpv_post_search']) ) {
        $query->posts = array();
        $query->found_posts = 0;
        $query->post_count = 0;
    }
    return $query;
}

Let me know if you have questions about this process and I'll try to provide more details.

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