WordPress.org

Ready to get started?Download WordPress

Forums

Query Multiple Taxonomies
[resolved] Stopping the drilldown (12 posts)

  1. mrarrow
    Member
    Posted 3 years ago #

    Hi, this might seem an usual request - I'm not sure!

    I'm using the php code of this widget in the sidebar of the home page and the sidebar of all internal pages too, specifying a set of taxonomies to display in dropdowns.

    Having done a query from the home page, how can I make sure that all my specified taxonomies and dropdowns still display on internal archive and search pages etc, rather than just the ones that are then appropriate to the current query results?

    Many thanks.

  2. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    Having done a query from the home page, how can I make sure that all my specified taxonomies and dropdowns still display on internal archive and search pages etc, rather than just the ones that are then appropriate to the current query results?

    Indeed unusual. Why do you want this behaviour?

  3. mrarrow
    Member
    Posted 3 years ago #

    Because once a user has done the intial search by selecting multiple dropdowns and is viewing the search results, then in my case, they have no need to further drill-down, as the results are pretty self-explanatory.

    And considering I was initially confused as to why this code was 'losing' dropdowns after a search (I thought it was the theme to start off with!), my "beloved" users are going to be even more befuddled.

    I take it its not simple to stop this behaviour then?

    Many thanks.

  4. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    I don't think I understand what you're trying to do. Do you have a live example somewhere?

  5. mrarrow
    Member
    Posted 3 years ago #

    The site is currently in development so its behind a log in at the moment.

    Basically I don't want the plugin to selectively hide dropdowns and items in the dropdown based on the search results being displayed.

    I'm after a multi dropdown search and once its displaying the search results, I want the widget to be ready to perform another new search (rather than any further drilling down of the current search results).

  6. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    Open query-multiple-taxonomies/widget.php and replace every instance of:

    $terms = qmt_get_terms( $taxonomy );

    with

    $terms = get_terms( $taxonomy );

  7. mrarrow
    Member
    Posted 3 years ago #

    Absolutely brilliant, nice one - that's fixed it! There were two incidences that had to be changed in that file.

    Maybe in a future release, this might be a worthwhile option to add as a configurable item within the backend widget interface (and in the php code)?

    I know it might not make immediate sense but once you see it in action, then I reckon its a valid request (at least to me!).

    That way, you still have the option of drilling down further on the search result page (as all the original dropdowns still have their values in them) or you can reset it and do a new search (I now just need to make sure the Reset button doesn't take me back to the home page - i.e. it keeps me on whatever the current page is).

    Once again, thanks very much - its much appreciated.

  8. anmari
    Member
    Posted 3 years ago #

    I'd like to chip into this discussion (in case any updates are going to be made :).

    1) Maybe a "reset search" or "new search" button would meet all needs and is consistent with many other search/filtering facilities?

    2) I'd love it there was an option to order by id - ie by order of creation, for situations where category has been "designed" and alpha or post count etc not suitable. There are plugins to re-order categories (does sound like there is a demand to be able to control taxonomy order), at moment I think only way is by id.

  9. mrarrow
    Member
    Posted 3 years ago #

    anmari: Yes, I guess it just needs to be a way of resetting the dropdown items to their default values (a bit like the standard HTML form reset value).

    In terms of sort order, I also experienced exactly the same thing! The way I got round it was to use the php code for the widget, rather than the drag and drop, tickbox-clicky version. So in the taxonomy array, I then simply typed the various taxonomies in the order I wanted them to appear.

  10. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    The reason some terms are hidden is because selecting them would return no results, since queries are additive. I guess that doesn't make so much sense for the dropdowns mode, since you can select all the properties at once, unlike in the lists mode.

    1) Maybe a "reset search" or "new search" button would meet all needs and is consistent with many other search/filtering facilities?

    There already is a reset button for the dropdowns mode (right next to the submit button).

    I should probably add it to the lists mode, too.

  11. mrarrow
    Member
    Posted 3 years ago #

    Yes there is a 'Reset' button, but it takes you back to the home page.

    I notice elsewhere in this forum that you can change the URL of 'Reset' link by doing:

    function my_qmt_base_url() {
    	return get_page_link( YOUR_PAGE_ID );
    }
    add_filter( 'qmt_base_url', 'my_qmt_base_url' );

    But would it not be even simpler to just clear the dropdowns and remain on whatever page you were currently on. The closest analogy would be like the familiar <input type="reset" value="Reset"> in a standard HTML form?

  12. macariojames
    Member
    Posted 3 years ago #

    I just wanted to say THANK YOU to Scribu! This plugin was a godsend. You saved me a lot of continued hours of learning how to use taxonomy queries, especially in a dropdown!

    But specifically, the tidbit you gave mrarrow above regarding changing qmt_get_terms() to get_terms was EXACTLY what i scoured the forum for.

    It was really annoying to my client having the options "disappear" if there were not associated posts with both or all three queries.

    Thanks, again! And I look forward to the next version.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic