Query Multiple Taxonomies
[resolved] Display Filtered Results on Custom Template (4 posts)

  1. duanecilliers
    Posted 5 years ago #

    Currently the filtered results are displayed using taxonomy.php. I have several custom post types, but I'm only using this plugin to filter taxonomies within the Documents custom post type.

    taxonomy.php is used for other taxonomies, so I'm unable to customize that template to my liking without messing up the display of other taxonomies.

    Is there a way to specify which template is used to display the filtered results?

    One more issue. I tried setting the base URL to my documents page using the following code in my themes functions.php

    function my_qmt_base_url( $base ) {
       return get_page_link( 22 );
    add_filter( 'qmt_base_url', 'my_qmt_base_url' );

    It was successful in setting the base URL, but now when I select terms to filter the search and hit Filter, the URL query seems correct, but the actual page is just refreshed with no changes to results.

    Any help is greatly appreciated.

  2. scribu
    Plugin Author

    Posted 5 years ago #

    One way to do it would be to add something like this in your functions.php file (not tested):

    // Load a different template for document taxonomies
    function document_taxonomy_template() {
      $queried_taxonomies = array_keys( qmt_get_query() );
      $matching_taxonomies = array_intersect( $queried_taxonomies, array( 'taxonomy-a', 'taxonomy-b', 'another-taxonomy' ) );
      if ( !empty( $matching_taxonomies ) ) {
        locate_template( 'document-taxonomy.php', true );
    add_action( 'template_redirect', 'document_taxonomy_template', 11 );

    So, document-taxonomy.php would be loaded if any of 'taxonomy-a', 'taxonomy-b', 'another-taxonomy' were queried.

  3. duanecilliers
    Posted 5 years ago #

    Thanks for the reply Scribu :) I will try this out and let you know how it goes.

  4. duanecilliers
    Posted 5 years ago #

    Works perfectly. Thanks Scribu :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Query Multiple Taxonomies
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic