Hi,
We have set up 5 different taxonomies under a post type called Members:
Groups
Type of Optic
Type of Service
Type of Material
Type of Research Interests
We created an archive page where we are able to search through the Groups taxonomy.
hidden link
We created a second page and inserted a view to search through all 4 “Types” taxonomies and added a text search box as well:
hidden link
But the search only brings up all the results. The text search works the same way.
What have we missed to get these search functions working on the same page?
Thank you
Please ignore the other duplicate support ticket and use this one.
Hi, can you edit this View in wp-admin and take a screenshot of the Query Filter section for me? I would like to see how it's configured. If you cannot see the Query Filter section, scroll to the top right corner and click "Screen Options". You will be able to enable the Query Filter panel here. I will review the settings and follow up here.
Marked resolved in error, sorry.
Here is the screenshot.
Can you show me how this View is inserted in the search-results page? If there is a Layout assigned to this page, please take a screenshot of the Layout editor. If there is a Content Template assigned to this page, please copy + paste the code from that template here. If the View is inserted directly in the page content, please copy + paste the code from that page here for me to review. Finally, please copy + paste the code from this View's Loop Editor here for me to review. If a Content Template is used in the Loop, please copy + paste the code from that template as well.
I'm seeing some strange nesting that could indicate a View pasted inside itself, or an incomplete View loop. I'll review your response and figure out what to try next.
Hi Christian -
1. First image is of the search-results layout editor.
2. This is the code for the search-results page:
<div class="container ddl-remove-bs-padding">
<div class="row ddl-frontend-editor-row ddl-frontend-editor-editable" data-id="6565" data-name="Row 2" data-type="row" data-layout_slug="" data-kind="Row">
<div class="col-md-12 ddl-frontend-editor-cell ddl-frontend-editor-editable js-ddl-frontend-editor-cell" data-id="s6541" data-name="Visual Editor" data-type="cell-text" data-layout_slug="" data-kind="Cell">
<h2>Search Results</h2>
hidden link">Back to Search
</div>
</div>
</div>
<div class="container-fluid ">
<div class="ddl-full-width-row row ddl-frontend-editor-row ddl-frontend-editor-editable" data-id="11" data-name="Post content row" data-type="row" data-layout_slug="" data-kind="Row">
<div class="col-md-12 ddl-frontend-editor-cell ddl-frontend-editor-editable js-ddl-frontend-editor-cell" data-id="s6571" data-name="members-found" data-type="views-content-grid-cell" data-layout_slug="" data-kind="Cell">[wpv-view name="members-found"]</div>
</div>
</div>
3. The second and third screen shots are of the members-found view.
4 Code for the members-found view
Search and Pagination:
[wpv-filter-start hide="false"]
[wpv-filter-controls][/wpv-filter-controls]
[wpv-filter-end]
Loop Editor:
<div class="container hide-mobile">
<div class="row">
<div class="col-sm-5">
<p>Company</p>
</div>
<div class="col-sm-2">
<p>Phone</p>
</div>
<div class="col-sm-2">
<p>City/State/Province</p>
</div>
<div class="col-sm-1">
<p>Country</p>
</div>
<div class="col-sm-2">
<p>Email</p>
</div>
</div>
<div class="col-sm-12" style="padding: 0;">
<hr style="margin-top: -10px; margin-bottom: 30px;"/>
</div>
</div>
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-post-body view_template="loop-item-in-directory-view-2"]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
Loop Item:
[wpv-post-link]
[types field='phone'][/types]
[types field='city'][/types]
[types field='state'][/types]
[types field='country'][/types]
[types field='contact-1-email'][/types]
Output Editor:
[wpv-filter-meta-html]
[wpv-layout-meta-html]
5. Should there be additional code for the text search results on this page as well to make that work as well?
Thanks for your help!
Okay you've provided screenshots from two different Views now. The first one, I'm not sure what the name of the View was but it had several Query Filters as shown in the query-section.png screenshot. The second View is called the Members Found View, and it contains no Query Filters. The Members Found View is being displayed on the search-results page. The first View is not being displayed on the search-results page, so the Query Filters there do not apply to the search-results results. You must apply the same Query Filters in both Views. Edit the Members Found View, scroll to the top right corner and click "Screen Options". In the configurations, check the "Query Filter" checkbox to display the Query Filter panel on the editor screen. Then, recreate the Query Filters from the first View here, including the same URL parameters and filter options.
Hi Christian - Sorry, but I can't get this to work.
I've think I've tried all the filter parameters, matched them in each view and either it shows no results or all results.
Is there a filter parameter you suggest? I first tried "All of the following" because we want to search for any Type that has been checked. No matter the options, everyone shows up.
thanks for your continued help!
I think it might be best at this point if I log in and take a look at how things are set up in wp-admin. If that's okay with you, please provide login credentials in the private fields here.
Okay based on the URL of the search-results page after I submit a search from the find-a-manufacturer page, I see that your actual URL parameters are set up like this:
- wpv-type-of-optic
- wpv-type-of-service
- wpv-type-of-material
- wpv-type-of-research-interest
However, your Members Found View's URL parameters do not contain hyphens. Check the screenshot here. The parameters engine will not be forgiving, and the names must be exactly the same for the filters to work. You can either add hyphens in the Members Found View's Query Filters, or you can remove them from the controls in the other View.
I also noticed the Content Template "Loop item in Directory View 2" has some issues that need to be fixed.
hidden link
It looks like maybe this was copied from a View's Loop Editor, because it contains Loop tags. None of these tags should be present in a Content Template applied to a View's Loop, because they are already present in the Loop:
- wpv-layout-start
- wpv-items-found
- wpv-loop-start
- wpv-loop
- wpv-loop-end
- wpv-layout-end
Here's the code as it should be:
<div class="container directory">
<div class="row">
<div class="col-md-5"><p style="margin-bottom: 0;"><strong>[wpv-post-link]</strong></p>
<p style="margin-bottom: 0;">[wpv-post-excerpt]</p>
</div>
<div class="col-md-2"><p>[types field='phone'][/types]</p></div>
<div class="col-md-2"><p>[types field='city'][/types] [types field='state'][/types]</p></div>
<div class="col-md-1"><p>[types field='country'][/types]</p></div>
<div class="col-md-2"><p>[types field='contact-1-email'][/types]</p></div>
</div>
<div class="col-md-12" style="padding: 0; margin: 0;"><hr />
</div>
</div>
Please try those changes and let me know the results.
Hi Christian - Thanks so much for you help on this.
I need to ask 2 more questions but the 2nd one I'll start in another thread.
When I was setting up the Taxonomy Filter, I tried all the options, figuring at first that the "All of the following filter" would be the one to select across the 4 taxonomies. Why is the "Set by one URL parameter" the best option here and how did the slug get mixed up when I was duplicating the filter?
thanks again.
When I was setting up the Taxonomy Filter, I tried all the options, figuring at first that the "All of the following filter" would be the one to select across the 4 taxonomies.
"All of the following filter" requires that you predefine the selected terms. In other words, you do not want your Users to choose their own filter criteria for these taxonomies. For example, when you want a View to only include results from terms a, b and c, and you do not want to show the Users search filter inputs to choose other terms.
how did the slug get mixed up when I was duplicating the filter?
I'm not sure, you can define arbitrary URL parameter slugs when creating the filters, and you can modify them later arbitrarily too. It's possible the default parameters were modified, or it's possible the default values are different depending on how you create the filters. I'm not sure offhand, probably nothing to worry about unless you're using two different Views for search and results like this.
Great support and feedback Christian! Thanks again.
Christian - I needed to adjust some HTML on the members found page and found this programming alert. See attached image.
Do I need to respond to that?