Home › Topic Tag: Custom search
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.
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Let custom search open in specific page
Started by: marcov-3 in: Toolset Professional Support |
2 | 5 | 6 years, 11 months ago | ||
Custom Search when Views are within a View
Started by: anna-maeT in: Types Community Support |
2 | 3 | 6 years, 11 months ago | ||
How to show the chosen taxonomies as filters using shortcodes?
Started by: AtefR7377 in: Toolset Professional Support |
2 | 10 | 6 years, 11 months ago | ||
Filter custom post by
Started by: culturaI
in: Types Community Support
Problem: I would like to create a custom search filter that lets me filter posts by "age", calculated from a date in a custom field. I would like to be able to select an age range in my custom search View. If I must filter by date range instead, I would like to show more than just 20 years in the datepicker's "year" select field. Solution: Views can let you set up a custom search filter between two values, but those values must be custom field values or the post date. They cannot be values calculated on-the-fly. "Age" is not a custom field value - it depends on a calculation using the current date. So there is not a good way to set that up in the Views GUI. I can help you set up filters between two custom field dates, but not between two ages. That would require a significant amount of custom code that falls outside the scope of the support we provide here in the forums. If you are comfortable writing your own code, you can use the wpv_filter_query API filter to apply a postmeta value range based on your own custom inputs. You could access the custom input values in PHP in the $_GET superglobal, and use those to calculate a start and end timestamp. Then you could apply those criteria to a meta query on your birthdate field. If you want to filter by date range using datepickers, you can control the year range using the standard jQuery UI option "yearRange": jQuery(document).ready(function(){ jQuery('input.hasDatepicker').datepicker('option',{'yearRange':'1990:2040'}); }); Relevant Documentation: |
2 | 5 | 6 years, 11 months ago | ||
Create a “mailto” link with repeating custom field values
Started by: culturaI
in: Types Community Support
Problem: I have a custom search View that shows a table of posts with filters. These posts include a repeating custom field where multiple email addresses can be stored. I would like to create a single link on the site that I can click to open a new email in Outlook, with all email addresses from these filtered posts used as recipients of the new email. Solution: <a href="mailto:email1@gmail.com,email2@gmail.com,email3@gmail.com">Your link text</a> Step 1. Create a new View that is a duplicate of the custom search View. In the Loop Output editor, replace the output with the code below: [wpv-layout-start][wpv-items-found]<!-- wpv-loop-start --><wpv-loop>[types field='email-field-slug' separator=',' output='raw'][/types],</wpv-loop><!-- wpv-loop-end -->[/wpv-items-found][wpv-no-items-found][/wpv-no-items-found][wpv-layout-end] Place this View somewhere on the same page as your custom search View. You should see a list of email addresses, separated by a comma. There may be some empty spaces, but that's okay. Step 2. Set up a text filter that removes all the empty spaces and extra markup from the output. In your child theme's functions.php file, add this code: function prefix_clean_view_output( $out, $id ) { $ids = array( 12345 ); if ( in_array( $id, $ids )) { $start = strpos( $out, '<!-- wpv-loop-start -->' ); if ( $start !== false && strrpos( $out, '<!-- wpv-loop-end -->', $start ) !== false ) { $start = $start + strlen( '<!-- wpv-loop-start -->' ); $out = substr( $out , $start ); $end = strrpos( $out, '<!-- wpv-loop-end -->' ); $out = substr( $out, 0, $end ); } else { $start = strpos( $out, '>' ); if ( $start !== false) { $out = substr( $out, $start + 1 ); $end = strpos( $out, '<' ); $out = trim(substr( $out, 0, $end )); } } } return $out; } add_filter( 'wpv_filter_wpv_view_shortcode_output', 'prefix_clean_view_output', 5, 2 ); Replace 12345 with the numeric ID of your new View. Now when you look at the results of this View you should not see the extra spaces or markup. Step 3. Use the results of this View to create a mailto link: <a href="mailto:[wpv-view name='your-new-view-slug']">Send an email</a> Replace your-new-view-slug with the slug of your new View. Now replace the new View shortcode on your site with the link code above. Relevant Documentation: https://toolset.com/documentation/user-guides/digging-into-view-outputs/ |
2 | 13 | 6 years, 11 months ago | ||
Choose from previously created fields dont show in view filter
Started by: davidZ-4
in: Toolset Professional Support
Problem: Solution: |
2 | 6 | 6 years, 12 months ago | ||
Search displays different excerpts depending on how the search is done.
Started by: JSG
in: Toolset Professional Support
Problem: The issue here is that the user is displaying is post excerpts on the parametric search but after performing a search the excerpts don't show anymore. Solution: In this case the issue was being caused by the user putting a field to search for that was not available on this CPT so it was messing with the view's display. I would recommend ensuring that the fields that are being searched for are available on the the CPT itself. |
2 | 9 | 6 years, 12 months ago | ||
Dynamic filter for each category
Started by: mohammad-rezaT in: Toolset Professional Support |
2 | 5 | 6 years, 12 months ago | ||
Create a tags list (for each post) with individual custom urls
Started by: lucaso
in: Types Community Support
Problem: I would like to create a list of taxonomy terms applied to each post. Each term's title should be displayed as a link to a custom page URL with different hashtags, like: Solution: Create a View of the tags taxonomy filtered by taxonomy term, set by the current post. This View will give you the ability to loop over each tag associated with the current post. You can build a custom link for each term using the taxonomy URL and taxonomy title shortcodes. Something like this in your Loop Output: [wpv-layout-start] [wpv-items-found] <!-- wpv-loop-start --> <wpv-loop> <a href="http://yoursite.com/pagexxx/#[wpv-taxonomy-slug]">[wpv-taxonomy-title]</a> </wpv-loop> <!-- wpv-loop-end --> [/wpv-items-found] [wpv-no-items-found] <strong>[wpml-string context="wpv-views"]No tags found for this post[/wpml-string]</strong> [/wpv-no-items-found] [wpv-layout-end] Relevant Documentation: |
2 | 5 | 6 years, 12 months ago | ||
How to create a view with Child Taxonomies as filter?
Started by: AtefR7377 in: Toolset Professional Support |
2 | 2 | 6 years, 12 months ago | ||
Sorting a View of posts by post author sorting by name instead of ID
Started by: JosV9233 in: Toolset Professional Support |
2 | 7 | 7 years ago | ||
js_event_wpv_parametric_search_results_updated not working
Started by: gnanasekaraL9305
in: Toolset Professional Support
Problem: The issue here is that the user is saying the js_event_wpv_parametric_search_results_updated callback function is not working Solution: In this user's case they didn't correctly formatted their code inside the function. The code needs to be inside the callback like this. jQuery( document ).on( 'js_event_wpv_parametric_search_form_updated', function( event, data ) { /** * data.view_unique_id (string) The View unique ID hash * data.view_changed_form (object) The jQuery object for the View form after being updated * data.view_changed_form_additional_forms_only (object) The jQuery object containing additional forms from other instances of the same View inserted using the [wpv-form-view] shortcode * data.view_changed_form_additional_forms_full (object) The jQuery object containing additional forms from other instances of the same View inserted using the [wpv-view] shortcode */ function initSlider() { console.log($('#wpv_control_textfield_min-price').val()); } }); |
2 | 2 | 7 years ago | ||
I need to create a custom field as hidden field
Started by: gnanasekaraL9305 in: Types Community Support |
1 | 3 | 7 years ago | ||
Searching by Age range with multiple values
Started by: rachelW-3 in: Toolset Professional Support |
2 | 2 | 7 years ago | ||
Create an automatic preview for the [File uploaded] by users.
Started by: imaneK
in: Toolset Professional Support
Problem: Solution: |
2 | 2 | 7 years ago |