WordPress.org

Support

Support » Plugins and Hacks » Query Multiple Taxonomies » Seperate Template for QMT Queries

Seperate Template for QMT Queries

  • Is there anyway to have QMT queries appear on their own template. I have tried adding the following code to my functions.php as suggested by scribu at http://wordpress.org/support/topic/display-filtered-results-on-custom-template.

    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 );
        die;
      }
    }
    add_action( 'template_redirect', 'document_taxonomy_template', 11 );

    This does exactly what it says and redirects any queries on the listed taxonomies to the specified template. I was wondering if this could be adapted so that only QMT queries are redirected but not the links to my taxonomy and term archives.

    Alternatively is there any way I can determine if the current page is the result of a QMT query.

    Any Ideas?

    Tkhan

    http://wordpress.org/extend/plugins/query-multiple-taxonomies/

  • The topic ‘Seperate Template for QMT Queries’ is closed to new replies.
Skip to toolbar