Support Forums

Support Forums Forums Search & Filter Pro Taxonomy Dropdown: only show based on included Tags, Categories & Taxonomies

This topic is: not resolved

This topic contains 16 replies, has 2 voices, and was last updated by  Trevor 5 months, 2 weeks ago.

Viewing 10 posts - 1 through 10 (of 17 total)
  • Luke Hartman
    #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:

    Taxonomy sorting setup: Directors

    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.

    All directors show up on Alubms page dropdown.

    I hope my explanation is ok 🙂

    Thanks again!
    Luke

    Luke Hartman
    #198632

    Taxonomy sorting setup: Directors

    All directors show up on Alubms page dropdown.

    The 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:

    Search and filter premiere_date

    My ACF settings for premiere_date:
    Screen-Shot-2019-01-10-at-6-03-50-PM

    The premiere_date ACF in my single-catalog.php file:
    single-catalog.php

    Any help would be super helpful!

    Thanks!
    -Luke

    Luke Hartman
    #198634

    Here is a look at the results from old to new sorting:

    Screen-Shot-2019-01-10-at-6-51-31-PM

    They bounce all around. From 1987 to 2000 to 1983 ext.

    Thanks again for your help!!
    -Luke

    Trevor Moderator
    #198663
    This reply has been marked as private.
    Luke Hartman
    #198685

    Hey 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. . .

    Luke Hartman
    #198687
    This reply has been marked as private.
    Luke Hartman
    #198691

    A 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

    search-and-filter-sidebar

    Each of our 4 subcategories has their own search results template file.

    Screen-Shot-2019-01-11-at-7-42-36-AM

    I did this so we can have 4 separate Search & Filter shortcodes to display on their respective search results page.

    search-and-filter-seperate-searches

    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!!
    -Luke

    Trevor Moderator
    #198700

    I 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 …. ?

    Luke Hartman
    #198704

    I think you’re right. These would have been entered into the database long before I set up your plugin. So what should we do to re-enter the dates into the database? Or something else entirely??

    Trevor Moderator
    #198706

    How many posts are there?

Viewing 10 posts - 1 through 10 (of 17 total)

You must be logged in to reply to this topic.