The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
Views plugin lets you build your own custom search for any content type. These searches can be based on post content, taxonomies and custom fields.
When you ask for help or report issues, make sure to tell us settings for your custom search.
Viewing 15 topics - 2,521 through 2,535 (of 2,535 total)
Problem: I would like to create a custom search View that I can place on the single post of my top-level hierarchical post type - the Grandparent post. In that search View I want to show a filter where the User can select any posts of the second-level post - the Parent post. The matching third-level posts - the Child posts, should appear beneath the search form.
Solution: In order to accomplish a parametric search of hierarchical post types like this, you must use URL parameters to predefine any level of the hierarchical relationship. If you do not want to include these parameters in your site links, you could consider a custom approach that redirects Users from the clean URLs to the parameterized URLs.
Problem: I would like to add a "Load More" button to my View similar to the Load More Tickets functionality in the forum search here on wp-types.com
Solution: Our developers have added this feature to their work queue, but it's not quite ready yet. The feature on our site is provided by a separate search system, but we plan to implement it similarly.
Problem: I would like preselect a taxonomy term filter in a parametric search View, and I would like to place that View on a taxonomy term archive URL.
Solution: The only way to preselect an option in a parametric search form is to use a URL parameter like yoursite.com/custom-search-page/?wpvcategory=uncategorized. If you try to place this custom search View on a taxonomy archive like yoursite.com/category/uncategorized, the "uncategorized" term will not be preselected in the taxonomy filter. You could automatically redirect the User to /category/uncategorized?wpvcategory=uncategorized using custom code to preselect the filter.
The issue here is that the user only wants to display his search results only after a search has been made.
Solution:
This is only possible if when you are inserting the view on the page you select the option "Search Form Only" where this will add the search form and then you can select which page you want to become your results page.
Take a look at this screenshot below.
@https://cdn.toolset.com/wp-content/uploads/2012/06/choose-what-part-of-the-custom-search-to-display.jpg?x45313
If you want the search form and results to appear on the same page, you will need to add some PHP that uses the Views API and returns no results if a search term isn't present.
The following solution is generic and tests whether any one of a custom field filter, taxonomy filter, or text search is being used. You may need to edit it for your specific circumstances.
/**
* No initial results
*
* Don't show View results until a filter has been applied
*
* Tests for custom field filters, taxonomy filters, or text searches
*/
function tssupp_no_initial_results( $query_results, $view_settings, $view_id ){
if ( 226 == $view_id ) { // Edit the id as required
// if there is a search term set
if ( !isset( $query_results->query['meta_query'] ) && !isset( $query_results->query['tax_query'] ) && !isset( $query_results->query['s'] ) ) {
$query_results->posts = array();
$query_results->post_count = 0;
}
}
return $query_results;
}
add_filter( 'wpv_filter_query_post_process', 'tssupp_no_initial_results', 10, 3 );
When the user clicked "Advanced Searching" it should open with additional filters.
Solution:
This is actually done by wrapping the other additional filters inside an accordion, this way when the user clicks the the button it opens the area with the other hidden filters. https://getbootstrap.com/docs/4.0/components/collapse/