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,611 through 2,625 (of 2,646 total)
Problem:
How to display taxonomy terms filter using checkboxes in hierarchical manner.
Solution:
To display terms with your taxonomy filter in hierarchical manner you should add attribute "output" to display filter with hierarchical terms:
Problem: I have a custom search View that includes two taxonomy filter controls and a text search field. Now, the View shows all results at first. I would like to hide all the results until the user selects at least one taxonomy or searches for some specific text. Here are the current filter controls:
Solution: Ensure your View's Filter Query section is configured appropriately for this search. It should include both taxonomy filters, as well as a text search filter. See the screenshot attached for the required configurations.
Next, add the following code to functions.php:
add_filter( 'wpv_filter_query', 'drop_empty_search_query', 10, 3 );
function drop_empty_search_query( $query_args, $view_settings, $view_id ) {
$ids = array(1, 2, 3);
if (in_array($view_id, $ids)){
if (
// taxonomy filter needs to check for not '0' as well as not empty
( isset($_GET['wpv-listing-category']) && $_GET['wpv-listing-category'] != '0' )
||
// taxonomy filter needs to check for not '0' as well as not empty
( isset($_GET['wpv-location']) && $_GET['wpv-location'] != '0' )
||
// text search only needs to check for not empty
( isset($_GET['wpv_post_search']) && $_GET['wpv_post_search'] != '' )
) {
} else {
$query_args['post__in'] = array(0);
}
}
return $query_args;
}
Replace 1, 2, 3 with your View ID or a comma-separated list of multiple View IDs where you want to apply this custom query filter.
Problem: I have a View that displays multiple post types. In that View, I have added a Query Filter that tests for a predefined value in a custom field, and I also have a Filter Control that lets Users select a taxonomy term. One post type never displays in the search results, despite havin
Solution: In this case, the Query Filter was set up using a custom field that was not present in one post type. Instead, a similar custom field was present in that post type, but used a different slug. Therefore the required custom field did not match the Query Filter, and none of the results from this post type would be displayed.
The solution is to use the same custom field in all post types. This may require placing the custom field in its own field group, so that it can be associated with all necessary post types.
Problem: One of my custom post types does not appear in standard text search results. I have chosen to index this post type in Relevanssi and rebuilt the index, I have checked the archive's Content Template source, and I have checked the post type's public status. None of these have helped.
Solution: Check the WordPress Archive settings to ensure the post type is included.