Forums › Forums › Search & Filter Pro › Taxonomy Dropdown: only show based on included Tags, Categories & Taxonomies
Tagged: categories, exclude, filtering taxonomies, include, tags, Taxonomies, taxonomy dropdown
- This topic has 16 replies, 2 voices, and was last updated 6 years, 4 months ago by
Trevor.
-
Anonymous(Private) January 10, 2019 at 8:17 pm #198622
Hello, your plugin is working great for our site! Thank you for the excellent development ๐
I did have one question, how can we limit what shows in the taxonomy dropdown strictly based on the Tags, Categories & Taxonomies(in our situation it is Categories) we have chosen to include.
Per our example:
Search in the following post types: Custom Post Type (catalog)
Display results method: As an Archive, custom templates for each category results(ex. search-catalot-film.php, search-catalog-album.php. . .)
Tags, Categories & Taxonomies: Include one category per search template file.And that is about as far as I got on filtering what shows in the Taxonomy dropdown. Here’s one of out taxonomy sorting setups:
Like in the Director’s taxonomy, we have a ton of Directors, but there is no need to show every single Director when you are filtering in the Albums page. Albums don’t generally have “Directors”. We would like to show only the taxonomy terms that are included in the categories.
I hope my explanation is ok ๐
Thanks again!
LukeAnonymous(Private) January 11, 2019 at 2:43 am #198632The images that didn’t go up earlier ^^^
I’m also having trouble sorting our custom post types by the date ACF I set up. I have it set to numeric:
My ACF settings for
premiere_date
:
The
premiere_date
ACF in mysingle-catalog.php
file:
Any help would be super helpful!
Thanks!
-LukeAnonymous(Private) January 11, 2019 at 3:33 pm #198685Hey Trevor, thanks for getting back to me!
I’ll send you the login first and then if that doesn’t fix it we can go to the second route.
**Posting this message for any future visitors trying to follow the conversation so they can find a fix as I did!
. . . sending a private message next. . .
Anonymous(Private) January 11, 2019 at 3:56 pm #198691A good example Search and filter sidebar from the site I sent you:
/category/distribution/film/
If I search “new to old” (meta value, ascending) on the film page this is the URL ending:
/?sfid=4737&sort_order=_sfm_premiere_date+desc+num
“old to new” :
/?sfid=4737&sort_order=_sfm_premiere_date+asc+num
Each of our 4 subcategories has their own search results template file.
I did this so we can have 4 separate Search & Filter shortcodes to display on their respective search results page.
This might be the long way around, but it made sense to me. Please let me know if you have a smarter way of doing this conditionally or something ๐
Since my search is loaded via an off-canvas element I have a file
search-off-canvas.php
that conditionally checks what category the page is on and loads the proper shortcode:<?php $categories = array( 1973, 1974, 1975, 1976, 1979, 1980 ); if (is_category($categories)) :?> <?php if (is_category(1973)) { // film echo '<h4 class="ml-2">Search Films</h4>'; echo do_shortcode('[searchandfilter id="4737"]'); // film } elseif (is_category(1976)) { //series echo '<h4 class="ml-2">Search Series</h4>'; echo do_shortcode('[searchandfilter id="4740"]'); } elseif (is_category(1975)) { //special echo '<h4 class="ml-2">Search Specials</h4>'; echo do_shortcode('[searchandfilter id="4741"]'); } elseif (is_category(1974)) { //album echo '<h4 class="ml-2">Search Albums</h4>'; echo do_shortcode('[searchandfilter id="4742"]'); } endif; ?>
As always, if you see a better way to do this, please let me know.
Let me know how I can help you on this.
Thanks Trevor!!
-LukeTrevor(Private) January 11, 2019 at 5:08 pm #198700I added premiere_date to the form so that I could see what values are stored in the database. I will screenshot this so you can see how I did this (I did not save the form):
https://www.screencast.com/t/7LnWl9JYJguo
You can see that the dates are in the wrong format to be sortable. They should look like YYYYMMDD, so today would be 20190111.
The return format in the field definition seems to be right (
Ymd
), so maybe these were stored before that was made, or …. ? -
AuthorPosts