WordPress.org

Ready to get started?Download WordPress

Forums

Query Multiple Taxonomies
is it possible to set up a special search with this plugin? (14 posts)

  1. Piet
    Member
    Posted 3 years ago #

    Hi Scribu,

    I read about your plugin in the comments thread over at Justin Tadlock's post.

    The way it was presented is that with your plugin it should be possible to give site visitors the possibility to search on multiple taxonomies.

    In this forum and on the plugin page I can however not find anything on how to set that up. Ideally I would like to come to something that looks like this website.

    Many thanks!

  2. Piet
    Member
    Posted 3 years ago #

    OK, discovered that there actually is a widget that can take care of this :)

    When trying the widget it turned out that it only works for taxonomies that are hanging under post-type 'post', but my taxonomies hang under post-type 'page' so I changed that accordingly in the plugin files:
    query-multiple-taxonomies.php line 88
    widget.php line 31

    One last question is: How can I use this as a search outside of the widgets?

    Thanks

  3. timothyharter
    Member
    Posted 3 years ago #

    What is the name of the widget you are using?

  4. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    @timothyharter: Taxonomy Drilldown (it's included in the plugin).

    @senlin: instead of modifying the plugin, you can add this code to your theme's functions.php file:

    function my_qmt_post_type() {
        return 'custom-post-type';
    }
    add_filter('qmt_post_type', 'my_qmt_post_type');

    One last question is: How can I use this as a search outside of the widgets?

    Not sure what you mean.

  5. Piet
    Member
    Posted 3 years ago #

    @scribu thx for the tip on adding the code to my functions.php instead of modifying the plugin!

    re my last question: I would like to be able to use the plugin as a search function on my website and not necessarily in widget style. What code would I need to add to my template files to make this possible?

    Thanks, the plugin does an excellent job!

  6. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    I saw your example link and I see what you're getting at now. Yes, it's possible, but it requires quite a bit of code to achieve.

  7. Piet
    Member
    Posted 3 years ago #

    Hmmm, I have been thinking on how to do it too.

    Ideally - and what I am aiming to achieve - there is a line of code that I can add to my template files. Lester Chan does that with most of his plugins, as you can see for example here: http://lesterchan.net/wordpress/readme/wp-postviews.html

    Perhaps another way of accomplishing it is to add a horizontal widget to my template files?

  8. Piet
    Member
    Posted 3 years ago #

    hi again scribu,

    something else I discovered with using your plugin that when clicking on the minus sign (-), you automatically return to the home page. Is it also possible to return to the main taxonomy instead of returning to the homepage?

    thanks.

  9. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    What do you mean by "the main taxonomy"? Could you give an example?

    Perhaps another way of accomplishing it is to add a horizontal widget to my template files?

    Yeah, you could add a sidebar that displays widgets horizontally, but you'd still have to write the widget.

  10. Piet
    Member
    Posted 3 years ago #

    explanation of returning to "the main taxonomy":

    Let's say we are on the about page. in the sidebar we have your widget running with a bunch of different taxonomies:

    product-type
    - A
    - B
    - C

    color
    - red
    - blue
    - green

    Now when I click on either one of the products and then either one of the colors, I will see the content that is applicable to those taxonomies.
    However, when I click on the minus sign [-] behind a taxonomy to unselect it, I am directed to the homepage of the website. I would either like to return to the page where I came from when Istarted selecting the taxonomies OR go to the page that shows the first (hierarchical) taxonomy (Products A, B & C)

    Do you understand what I mean now?

  11. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    Yes, except WordPress doesn't have a /product-type/ page, just like it doesn't have a /category/ page. It only has /product-type/a/ etc.

  12. Piet
    Member
    Posted 3 years ago #

    I am not sure if I understand what you mean, I think it also largely depends on how people have the permalinks set up...

    Would it be possible for you to point me in the direction so I could tweak the plugin to my own liking and let it go where I want it to go, instead of going back to the home page?

  13. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    In the development version, you can use the 'qmt_base_url' filter:

    function my_qmt_base_url( $url ) {
        $query = QMT_Core::get_actual_query();
    
        if ( empty( $query ) )
            return $url;
    
        return site_url('some-page');
    }
    add_filter('qmt_base_url', 'my_qmt_base_url');

    To make the user go back to the page he started on, you will need to use a browser cookie.

  14. Piet
    Member
    Posted 3 years ago #

    cool, thanks scribu!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic